forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.h
73 lines (54 loc) · 1.91 KB
/
installer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_INSTALLER_H_
#define CHROME_UPDATER_INSTALLER_H_
#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "base/version.h"
#include "components/update_client/update_client.h"
namespace updater {
class Installer final : public update_client::CrxInstaller {
public:
struct InstallInfo {
InstallInfo();
~InstallInfo();
base::FilePath install_dir;
base::Version version;
std::string fingerprint;
std::unique_ptr<base::DictionaryValue> manifest;
private:
DISALLOW_COPY_AND_ASSIGN(InstallInfo);
};
explicit Installer(const std::string& app_id);
const std::string app_id() const { return app_id_; }
// Finds the highest version install of the app, and updates the install
// info for this installer instance.
void FindInstallOfApp();
// Returns a CrxComponent instance that describes the current install
// state of the app.
update_client::CrxComponent MakeCrxComponent();
private:
~Installer() override;
// Overrides from update_client::CrxInstaller.
void OnUpdateError(int error) override;
void Install(const base::FilePath& unpack_path,
const std::string& public_key,
Callback callback) override;
bool GetInstalledFile(const std::string& file,
base::FilePath* installed_file) override;
bool Uninstall() override;
Result InstallHelper(const base::FilePath& unpack_path);
const std::string app_id_;
std::unique_ptr<InstallInfo> install_info_;
DISALLOW_COPY_AND_ASSIGN(Installer);
};
} // namespace updater
#endif // CHROME_UPDATER_INSTALLER_H_