OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 virtual bool Install(const base::DictionaryValue& manifest, | 38 virtual bool Install(const base::DictionaryValue& manifest, |
39 const base::FilePath& unpack_path) = 0; | 39 const base::FilePath& unpack_path) = 0; |
40 | 40 |
41 // Set |installed_file| to the full path to the installed |file|. |file| is | 41 // Set |installed_file| to the full path to the installed |file|. |file| is |
42 // the filename of the file in this component's CRX. Returns false if this is | 42 // the filename of the file in this component's CRX. Returns false if this is |
43 // not possible (the file has been removed or modified, or its current | 43 // not possible (the file has been removed or modified, or its current |
44 // location is unknown). Otherwise, returns true. | 44 // location is unknown). Otherwise, returns true. |
45 virtual bool GetInstalledFile(const std::string& file, | 45 virtual bool GetInstalledFile(const std::string& file, |
46 base::FilePath* installed_file) = 0; | 46 base::FilePath* installed_file) = 0; |
47 | 47 |
| 48 // Called by the component updater when a component has been unregistered and |
| 49 // all versions should be uninstalled from disk. Returns true if |
| 50 // uninstallation is supported, false otherwise. |
| 51 virtual bool Uninstall() = 0; |
| 52 |
48 protected: | 53 protected: |
49 friend class base::RefCountedThreadSafe<ComponentInstaller>; | 54 friend class base::RefCountedThreadSafe<ComponentInstaller>; |
50 | 55 |
51 virtual ~ComponentInstaller() {} | 56 virtual ~ComponentInstaller() {} |
52 }; | 57 }; |
53 | 58 |
54 // Describes a particular component that can be installed or updated. This | 59 // Describes a particular component that can be installed or updated. This |
55 // structure is required to register a component with the component updater. | 60 // structure is required to register a component with the component updater. |
56 // |pk_hash| is the SHA256 hash of the component's public key. If the component | 61 // |pk_hash| is the SHA256 hash of the component's public key. If the component |
57 // is to be installed then version should be "0" or "0.0", else it should be | 62 // is to be installed then version should be "0" or "0.0", else it should be |
58 // the current version. |fingerprint|, and |name| are optional. | 63 // the current version. |fingerprint|, and |name| are optional. |
59 // |allow_background_download| specifies that the component can be background | 64 // |allow_background_download| specifies that the component can be background |
60 // downloaded in some cases. The default for this value is |true| and the value | 65 // downloaded in some cases. The default for this value is |true| and the value |
61 // can be overriden at the registration time. This is a temporary change until | 66 // can be overriden at the registration time. This is a temporary change until |
62 // the issue 340448 is resolved. | 67 // the issue 340448 is resolved. |
63 struct CrxComponent { | 68 struct CrxComponent { |
64 std::vector<uint8_t> pk_hash; | 69 std::vector<uint8_t> pk_hash; |
65 scoped_refptr<ComponentInstaller> installer; | 70 scoped_refptr<ComponentInstaller> installer; |
66 Version version; | 71 Version version; |
67 std::string fingerprint; | 72 std::string fingerprint; |
68 std::string name; | 73 std::string name; |
69 bool allow_background_download; | 74 bool allow_background_download; |
70 CrxComponent(); | 75 CrxComponent(); |
71 ~CrxComponent(); | 76 ~CrxComponent(); |
72 }; | 77 }; |
73 | 78 |
74 } // namespace update_client | 79 } // namespace update_client |
75 | 80 |
76 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 81 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
OLD | NEW |