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 "base/files/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/component_updater/component_updater_service.h" |
| 11 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h" |
| 12 |
8 class CommandLine; | 13 class CommandLine; |
9 class ComponentUpdateService; | |
10 class Version; | 14 class Version; |
11 | 15 |
12 namespace base { | 16 namespace base { |
13 class DictionaryValue; | 17 class DictionaryValue; |
14 } | 18 } |
15 | 19 |
16 // Component update registration for Portable Native Client. | 20 // Component installer responsible for Portable Native Client files. |
17 void RegisterPnaclComponent(ComponentUpdateService* cus, | 21 // Files can be installed to a shared location, or be installed to |
18 const CommandLine& command_line); | 22 // a per-user location. |
| 23 class PnaclComponentInstaller : public ComponentInstaller { |
| 24 public: |
| 25 PnaclComponentInstaller(); |
| 26 |
| 27 virtual ~PnaclComponentInstaller(); |
| 28 |
| 29 virtual void OnUpdateError(int error) OVERRIDE; |
| 30 |
| 31 virtual bool Install(base::DictionaryValue* manifest, |
| 32 const base::FilePath& unpack_path) OVERRIDE; |
| 33 |
| 34 // Register a PNaCl component for the first time. |
| 35 void RegisterPnaclComponent(ComponentUpdateService* cus, |
| 36 const CommandLine& command_line); |
| 37 |
| 38 // Check the PNaCl version again and re-register with the component |
| 39 // updater service. |
| 40 void ReRegisterPnacl(); |
| 41 |
| 42 bool per_user() const { return per_user_; } |
| 43 |
| 44 // If per_user, function to call when profile is changed. |
| 45 void OnProfileChange(); |
| 46 |
| 47 // Determine the base directory for storing each version of PNaCl. |
| 48 base::FilePath GetPnaclBaseDirectory(); |
| 49 |
| 50 Version current_version() const { return current_version_; } |
| 51 |
| 52 void set_current_version(const Version& v) { current_version_ = v; } |
| 53 |
| 54 ComponentUpdateService* cus() const { return cus_; } |
| 55 |
| 56 private: |
| 57 bool per_user_; |
| 58 scoped_ptr<PnaclProfileObserver> profile_observer_; |
| 59 base::FilePath current_profile_path_; |
| 60 Version current_version_; |
| 61 ComponentUpdateService* cus_; |
| 62 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
| 63 }; |
19 | 64 |
20 // Returns true if this browser is compatible with the given Pnacl component | 65 // Returns true if this browser is compatible with the given Pnacl component |
21 // manifest, with the version specified in the manifest in |version_out|. | 66 // manifest, with the version specified in the manifest in |version_out|. |
22 bool CheckPnaclComponentManifest(base::DictionaryValue* manifest, | 67 bool CheckPnaclComponentManifest(base::DictionaryValue* manifest, |
23 Version* version_out); | 68 Version* version_out); |
24 | 69 |
25 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 70 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
OLD | NEW |