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/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 #include "chrome/browser/component_updater/component_updater_service.h" | 16 #include "chrome/browser/component_updater/component_updater_service.h" |
17 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h" | |
18 | 17 |
19 namespace base { | 18 namespace base { |
20 class CommandLine; | 19 class CommandLine; |
21 class DictionaryValue; | 20 class DictionaryValue; |
22 } | 21 } |
23 | 22 |
24 namespace pnacl { | 23 namespace pnacl { |
25 // Returns true if PNaCl actually needs an on-demand component update. | 24 // Returns true if PNaCl actually needs an on-demand component update. |
26 // 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, |
27 // 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 |
(...skipping 19 matching lines...) Expand all Loading... |
47 virtual bool Install(const base::DictionaryValue& manifest, | 46 virtual bool Install(const base::DictionaryValue& manifest, |
48 const base::FilePath& unpack_path) OVERRIDE; | 47 const base::FilePath& unpack_path) OVERRIDE; |
49 | 48 |
50 virtual bool GetInstalledFile(const std::string& file, | 49 virtual bool GetInstalledFile(const std::string& file, |
51 base::FilePath* installed_file) OVERRIDE; | 50 base::FilePath* installed_file) OVERRIDE; |
52 | 51 |
53 // Register a PNaCl component for the first time. | 52 // Register a PNaCl component for the first time. |
54 void RegisterPnaclComponent(ComponentUpdateService* cus, | 53 void RegisterPnaclComponent(ComponentUpdateService* cus, |
55 const base::CommandLine& command_line); | 54 const base::CommandLine& command_line); |
56 | 55 |
57 // Check the PNaCl version again and re-register with the component | |
58 // updater service. | |
59 void ReRegisterPnacl(); | |
60 | |
61 CrxComponent GetCrxComponent(); | 56 CrxComponent GetCrxComponent(); |
62 | 57 |
63 // Return true if PNaCl installs are separated by user. | |
64 bool per_user() const { return per_user_; } | |
65 | |
66 // If per_user, function to call when profile is changed. | |
67 void OnProfileChange(); | |
68 | |
69 // Return true if PNaCl updates are disabled. | 58 // Return true if PNaCl updates are disabled. |
70 bool updates_disabled() const { return updates_disabled_; } | 59 bool updates_disabled() const { return updates_disabled_; } |
71 | 60 |
72 // Determine the base directory for storing each version of PNaCl. | 61 // Determine the base directory for storing each version of PNaCl. |
73 base::FilePath GetPnaclBaseDirectory(); | 62 base::FilePath GetPnaclBaseDirectory(); |
74 | 63 |
75 base::Version current_version() const { return current_version_; } | 64 base::Version current_version() const { return current_version_; } |
76 | 65 |
77 void set_current_version(const base::Version& current_version) { | 66 void set_current_version(const base::Version& current_version) { |
78 current_version_ = current_version; | 67 current_version_ = current_version; |
79 } | 68 } |
80 | 69 |
81 std::string current_fingerprint() const { return current_fingerprint_; } | 70 std::string current_fingerprint() const { return current_fingerprint_; } |
82 | 71 |
83 void set_current_fingerprint(const std::string& current_fingerprint) { | 72 void set_current_fingerprint(const std::string& current_fingerprint) { |
84 current_fingerprint_ = current_fingerprint; | 73 current_fingerprint_ = current_fingerprint; |
85 } | 74 } |
86 | 75 |
87 ComponentUpdateService* cus() const { return cus_; } | 76 ComponentUpdateService* cus() const { return cus_; } |
88 | 77 |
89 private: | 78 private: |
90 bool per_user_; | |
91 bool updates_disabled_; | 79 bool updates_disabled_; |
92 scoped_ptr<PnaclProfileObserver> profile_observer_; | |
93 base::FilePath current_profile_path_; | |
94 base::Version current_version_; | 80 base::Version current_version_; |
95 std::string current_fingerprint_; | 81 std::string current_fingerprint_; |
96 ComponentUpdateService* cus_; | 82 ComponentUpdateService* cus_; |
97 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); | 83 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
98 }; | 84 }; |
99 | 85 |
100 } // namespace component_updater | 86 } // namespace component_updater |
101 | 87 |
102 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 88 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
OLD | NEW |