| 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 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class CommandLine; | |
| 20 class DictionaryValue; | 19 class DictionaryValue; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace pnacl { | 22 namespace pnacl { |
| 24 // Returns true if PNaCl actually needs an on-demand component update. | 23 // 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, | 24 // 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 | 25 // or the current version is behind chrome's version, and is ABI incompatible |
| 27 // with chrome. If not necessary, returns false. | 26 // with chrome. If not necessary, returns false. |
| 28 // May conservatively return false before PNaCl is registered, but | 27 // May conservatively return false before PNaCl is registered, but |
| 29 // should return the right answer after it is registered. | 28 // should return the right answer after it is registered. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 43 | 42 |
| 44 virtual void OnUpdateError(int error) OVERRIDE; | 43 virtual void OnUpdateError(int error) OVERRIDE; |
| 45 | 44 |
| 46 virtual bool Install(const base::DictionaryValue& manifest, | 45 virtual bool Install(const base::DictionaryValue& manifest, |
| 47 const base::FilePath& unpack_path) OVERRIDE; | 46 const base::FilePath& unpack_path) OVERRIDE; |
| 48 | 47 |
| 49 virtual bool GetInstalledFile(const std::string& file, | 48 virtual bool GetInstalledFile(const std::string& file, |
| 50 base::FilePath* installed_file) OVERRIDE; | 49 base::FilePath* installed_file) OVERRIDE; |
| 51 | 50 |
| 52 // Register a PNaCl component for the first time. | 51 // Register a PNaCl component for the first time. |
| 53 void RegisterPnaclComponent(ComponentUpdateService* cus, | 52 void RegisterPnaclComponent(ComponentUpdateService* cus); |
| 54 const base::CommandLine& command_line); | |
| 55 | 53 |
| 56 CrxComponent GetCrxComponent(); | 54 CrxComponent GetCrxComponent(); |
| 57 | 55 |
| 58 // Return true if PNaCl updates are disabled. | |
| 59 bool updates_disabled() const { return updates_disabled_; } | |
| 60 | |
| 61 // Determine the base directory for storing each version of PNaCl. | 56 // Determine the base directory for storing each version of PNaCl. |
| 62 base::FilePath GetPnaclBaseDirectory(); | 57 base::FilePath GetPnaclBaseDirectory(); |
| 63 | 58 |
| 64 base::Version current_version() const { return current_version_; } | 59 base::Version current_version() const { return current_version_; } |
| 65 | 60 |
| 66 void set_current_version(const base::Version& current_version) { | 61 void set_current_version(const base::Version& current_version) { |
| 67 current_version_ = current_version; | 62 current_version_ = current_version; |
| 68 } | 63 } |
| 69 | 64 |
| 70 std::string current_fingerprint() const { return current_fingerprint_; } | 65 std::string current_fingerprint() const { return current_fingerprint_; } |
| 71 | 66 |
| 72 void set_current_fingerprint(const std::string& current_fingerprint) { | 67 void set_current_fingerprint(const std::string& current_fingerprint) { |
| 73 current_fingerprint_ = current_fingerprint; | 68 current_fingerprint_ = current_fingerprint; |
| 74 } | 69 } |
| 75 | 70 |
| 76 ComponentUpdateService* cus() const { return cus_; } | 71 ComponentUpdateService* cus() const { return cus_; } |
| 77 | 72 |
| 78 private: | 73 private: |
| 79 bool updates_disabled_; | |
| 80 base::Version current_version_; | 74 base::Version current_version_; |
| 81 std::string current_fingerprint_; | 75 std::string current_fingerprint_; |
| 82 ComponentUpdateService* cus_; | 76 ComponentUpdateService* cus_; |
| 83 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); | 77 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
| 84 }; | 78 }; |
| 85 | 79 |
| 86 } // namespace component_updater | 80 } // namespace component_updater |
| 87 | 81 |
| 88 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ | 82 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
| OLD | NEW |