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 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 base::FilePath* installed_file) OVERRIDE; | 40 base::FilePath* installed_file) OVERRIDE; |
41 | 41 |
42 // Register a PNaCl component for the first time. | 42 // Register a PNaCl component for the first time. |
43 void RegisterPnaclComponent(ComponentUpdateService* cus, | 43 void RegisterPnaclComponent(ComponentUpdateService* cus, |
44 const CommandLine& command_line); | 44 const CommandLine& command_line); |
45 | 45 |
46 // Check the PNaCl version again and re-register with the component | 46 // Check the PNaCl version again and re-register with the component |
47 // updater service. | 47 // updater service. |
48 void ReRegisterPnacl(); | 48 void ReRegisterPnacl(); |
49 | 49 |
50 CrxComponent GetCrxComponent(); | |
51 | |
50 // Return true if PNaCl installs are separated by user. | 52 // Return true if PNaCl installs are separated by user. |
51 bool per_user() const { return per_user_; } | 53 bool per_user() const { return per_user_; } |
52 | 54 |
53 // If per_user, function to call when profile is changed. | 55 // If per_user, function to call when profile is changed. |
54 void OnProfileChange(); | 56 void OnProfileChange(); |
55 | 57 |
56 // Return true if PNaCl updates are disabled. | 58 // Return true if PNaCl updates are disabled. |
57 bool updates_disabled() const { return updates_disabled_; } | 59 bool updates_disabled() const { return updates_disabled_; } |
58 | 60 |
59 // Determine the base directory for storing each version of PNaCl. | 61 // Determine the base directory for storing each version of PNaCl. |
60 base::FilePath GetPnaclBaseDirectory(); | 62 base::FilePath GetPnaclBaseDirectory(); |
61 | 63 |
62 base::Version current_version() const { return current_version_; } | 64 base::Version current_version() const { return current_version_; } |
63 | 65 |
64 void set_current_version(const base::Version& v) { current_version_ = v; } | 66 void set_current_version(const base::Version& v) { current_version_ = v; } |
65 | 67 |
66 ComponentUpdateService* cus() const { return cus_; } | 68 ComponentUpdateService* cus() const { return cus_; } |
67 | 69 |
68 typedef base::Callback<void(bool)> InstallCallback; | 70 typedef base::Callback<void(bool)> InstallCallback; |
69 void AddInstallCallback(const InstallCallback& cb); | |
70 | 71 |
71 void NotifyInstallError(); | 72 // Ask the component updater service to do a first-install for PNaCl. |
73 // The |installed| callback will be run with |true| on success, | |
74 // or run with |false| on an error. The callback is called on the UI thread. | |
75 void RequestFirstInstall(const InstallCallback& installed); | |
72 | 76 |
77 private: | |
78 friend class PnaclUpdaterObserver; | |
79 | |
80 // Called when a RequestFirstInstall completed successfully. | |
73 void NotifyInstallSuccess(); | 81 void NotifyInstallSuccess(); |
74 | 82 |
75 private: | 83 // Called when a RequestFirstInstall will not happen, or an error occurred. |
76 // Cancel a particular callback after a timeout. | 84 void NotifyInstallError(); |
77 void CancelCallback(int callback_num); | |
78 | |
79 void NotifyAllWithResult(bool status); | |
80 | 85 |
81 bool per_user_; | 86 bool per_user_; |
82 bool updates_disabled_; | 87 bool updates_disabled_; |
83 scoped_ptr<PnaclProfileObserver> profile_observer_; | 88 scoped_ptr<PnaclProfileObserver> profile_observer_; |
84 base::FilePath current_profile_path_; | 89 base::FilePath current_profile_path_; |
85 base::Version current_version_; | 90 base::Version current_version_; |
86 ComponentUpdateService* cus_; | 91 ComponentUpdateService* cus_; |
87 // Counter to issue identifiers to each callback. | 92 // The one callback to call when there is a RequestFirstInstall. |
88 int callback_nums_; | 93 InstallCallback install_callback_; |
89 // List of callbacks to issue when an install completes successfully. | |
90 std::list<std::pair<InstallCallback, int> > install_callbacks_; | |
91 // Component updater service observer, to determine when an on-demand | 94 // Component updater service observer, to determine when an on-demand |
92 // install request failed. | 95 // install request failed. |
93 scoped_ptr<PnaclUpdaterObserver> updater_observer_; | 96 scoped_ptr<PnaclUpdaterObserver> updater_observer_; |
94 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); | 97 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
95 }; | 98 }; |
96 | 99 |
97 // Returns true if this browser is compatible with the given Pnacl component | |
98 // manifest, with the version specified in the manifest in |version_out|. | |
99 bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest, | |
jvoung (off chromium)
2013/08/02 21:17:59
Noticed that this shouldn't have been in the globa
| |
100 base::Version* version_out); | |
101 | |
102 // Ask the given component updater service to do a first-install for PNaCl. | |
103 // The |installed| callback will be run with |true| on success, | |
104 // or run with |false| on an error. The callback is called on the UI thread. | |
105 void RequestFirstInstall(ComponentUpdateService* cus, | |
106 PnaclComponentInstaller* pci, | |
107 const base::Callback<void(bool)>& installed); | |
108 | |
109 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 100 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
OLD | NEW |