OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/version.h" | 16 #include "base/version.h" |
17 #include "components/component_updater/component_updater_service.h" | 17 #include "components/update_client/update_client.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
21 } | 21 } |
22 | 22 |
23 namespace pnacl { | 23 namespace pnacl { |
24 // Returns true if PNaCl actually needs an on-demand component update. | 24 // Returns true if PNaCl actually needs an on-demand component update. |
25 // E.g., if PNaCl is not yet installed and the user is loading a PNaCl app, | 25 // E.g., if PNaCl is not yet installed and the user is loading a PNaCl app, |
26 // or the current version is behind chrome's version, and is ABI incompatible | 26 // or the current version is behind chrome's version, and is ABI incompatible |
27 // with chrome. If not necessary, returns false. | 27 // with chrome. If not necessary, returns false. |
28 // May conservatively return false before PNaCl is registered, but | 28 // May conservatively return false before PNaCl is registered, but |
29 // should return the right answer after it is registered. | 29 // should return the right answer after it is registered. |
30 bool NeedsOnDemandUpdate(); | 30 bool NeedsOnDemandUpdate(); |
31 } | 31 } |
32 | 32 |
33 namespace component_updater { | 33 namespace component_updater { |
34 | 34 |
| 35 class ComponentUpdateService; |
| 36 |
35 // Component installer responsible for Portable Native Client files. | 37 // Component installer responsible for Portable Native Client files. |
36 // Files can be installed to a shared location, or be installed to | 38 // Files can be installed to a shared location, or be installed to |
37 // a per-user location. | 39 // a per-user location. |
38 class PnaclComponentInstaller : public ComponentInstaller { | 40 class PnaclComponentInstaller : public update_client::ComponentInstaller { |
39 public: | 41 public: |
40 PnaclComponentInstaller(); | 42 PnaclComponentInstaller(); |
41 | 43 |
42 ~PnaclComponentInstaller() override; | 44 ~PnaclComponentInstaller() override; |
43 | 45 |
44 void OnUpdateError(int error) override; | 46 void OnUpdateError(int error) override; |
45 | 47 |
46 bool Install(const base::DictionaryValue& manifest, | 48 bool Install(const base::DictionaryValue& manifest, |
47 const base::FilePath& unpack_path) override; | 49 const base::FilePath& unpack_path) override; |
48 | 50 |
49 bool GetInstalledFile(const std::string& file, | 51 bool GetInstalledFile(const std::string& file, |
50 base::FilePath* installed_file) override; | 52 base::FilePath* installed_file) override; |
51 | 53 |
52 // Register a PNaCl component for the first time. | 54 // Register a PNaCl component for the first time. |
53 void RegisterPnaclComponent(ComponentUpdateService* cus); | 55 void RegisterPnaclComponent(ComponentUpdateService* cus); |
54 | 56 |
55 CrxComponent GetCrxComponent(); | 57 update_client::CrxComponent GetCrxComponent(); |
56 | 58 |
57 // Determine the base directory for storing each version of PNaCl. | 59 // Determine the base directory for storing each version of PNaCl. |
58 base::FilePath GetPnaclBaseDirectory(); | 60 base::FilePath GetPnaclBaseDirectory(); |
59 | 61 |
60 base::Version current_version() const { return current_version_; } | 62 base::Version current_version() const { return current_version_; } |
61 | 63 |
62 void set_current_version(const base::Version& current_version) { | 64 void set_current_version(const base::Version& current_version) { |
63 current_version_ = current_version; | 65 current_version_ = current_version; |
64 } | 66 } |
65 | 67 |
66 std::string current_fingerprint() const { return current_fingerprint_; } | 68 std::string current_fingerprint() const { return current_fingerprint_; } |
67 | 69 |
68 void set_current_fingerprint(const std::string& current_fingerprint) { | 70 void set_current_fingerprint(const std::string& current_fingerprint) { |
69 current_fingerprint_ = current_fingerprint; | 71 current_fingerprint_ = current_fingerprint; |
70 } | 72 } |
71 | 73 |
72 ComponentUpdateService* cus() const { return cus_; } | 74 ComponentUpdateService* cus() const { return cus_; } |
73 | 75 |
74 private: | 76 private: |
75 base::Version current_version_; | 77 base::Version current_version_; |
76 std::string current_fingerprint_; | 78 std::string current_fingerprint_; |
77 ComponentUpdateService* cus_; | 79 ComponentUpdateService* cus_; |
78 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); | 80 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace component_updater | 83 } // namespace component_updater |
82 | 84 |
83 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 85 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
OLD | NEW |