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.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "chrome/browser/component_updater/component_updater_service.h" | 15 #include "chrome/browser/component_updater/component_updater_service.h" |
16 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h" | 16 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h" |
17 #include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h" | |
18 | 17 |
19 class CommandLine; | 18 class CommandLine; |
20 | 19 |
21 namespace base { | 20 namespace base { |
22 class DictionaryValue; | 21 class DictionaryValue; |
23 } | 22 } |
24 | 23 |
25 // Component installer responsible for Portable Native Client files. | 24 // Component installer responsible for Portable Native Client files. |
26 // Files can be installed to a shared location, or be installed to | 25 // Files can be installed to a shared location, or be installed to |
27 // a per-user location. | 26 // a per-user location. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 67 } |
69 | 68 |
70 std::string current_fingerprint() const { return current_fingerprint_; } | 69 std::string current_fingerprint() const { return current_fingerprint_; } |
71 | 70 |
72 void set_current_fingerprint(const std::string& current_fingerprint) { | 71 void set_current_fingerprint(const std::string& current_fingerprint) { |
73 current_fingerprint_ = current_fingerprint; | 72 current_fingerprint_ = current_fingerprint; |
74 } | 73 } |
75 | 74 |
76 ComponentUpdateService* cus() const { return cus_; } | 75 ComponentUpdateService* cus() const { return cus_; } |
77 | 76 |
78 typedef base::Callback<void(bool)> InstallCallback; | |
79 | |
80 // Ask the component updater service to do a first-install for PNaCl. | |
81 // The |installed| callback will be run with |true| on success, | |
82 // or run with |false| on an error. The callback is called on the UI thread. | |
83 void RequestFirstInstall(const InstallCallback& installed); | |
84 | |
85 private: | 77 private: |
86 friend class PnaclUpdaterObserver; | |
87 | |
88 // Called when a RequestFirstInstall completed successfully. | |
89 void NotifyInstallSuccess(); | |
90 | |
91 // Called when a RequestFirstInstall will not happen, or an error occurred. | |
92 void NotifyInstallError(); | |
93 | |
94 bool per_user_; | 78 bool per_user_; |
95 bool updates_disabled_; | 79 bool updates_disabled_; |
96 scoped_ptr<PnaclProfileObserver> profile_observer_; | 80 scoped_ptr<PnaclProfileObserver> profile_observer_; |
97 base::FilePath current_profile_path_; | 81 base::FilePath current_profile_path_; |
98 base::Version current_version_; | 82 base::Version current_version_; |
99 std::string current_fingerprint_; | 83 std::string current_fingerprint_; |
100 ComponentUpdateService* cus_; | 84 ComponentUpdateService* cus_; |
101 // The one callback to call when there is a RequestFirstInstall. | |
102 InstallCallback install_callback_; | |
103 // Component updater service observer, to determine when an on-demand | |
104 // install request failed. | |
105 scoped_ptr<PnaclUpdaterObserver> updater_observer_; | |
106 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); | 85 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
107 }; | 86 }; |
108 | 87 |
109 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 88 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
OLD | NEW |