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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/version.h"
15 #include "chrome/browser/component_updater/component_updater_service.h"
16 #include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h"
21 class DictionaryValue;
24 // Component installer responsible for Portable Native Client files.
25 // Files can be installed to a shared location, or be installed to
26 // a per-user location.
27 class PnaclComponentInstaller : public ComponentInstaller {
29 PnaclComponentInstaller();
31 virtual ~PnaclComponentInstaller();
33 virtual void OnUpdateError(int error) OVERRIDE;
35 virtual bool Install(const base::DictionaryValue& manifest,
36 const base::FilePath& unpack_path) OVERRIDE;
38 virtual bool GetInstalledFile(const std::string& file,
39 base::FilePath* installed_file) OVERRIDE;
41 // Register a PNaCl component for the first time.
42 void RegisterPnaclComponent(ComponentUpdateService* cus,
43 const CommandLine& command_line);
45 // Check the PNaCl version again and re-register with the component
47 void ReRegisterPnacl();
49 CrxComponent GetCrxComponent();
51 // Return true if PNaCl installs are separated by user.
52 bool per_user() const { return per_user_; }
54 // If per_user, function to call when profile is changed.
55 void OnProfileChange();
57 // Return true if PNaCl updates are disabled.
58 bool updates_disabled() const { return updates_disabled_; }
60 // Determine the base directory for storing each version of PNaCl.
61 base::FilePath GetPnaclBaseDirectory();
63 base::Version current_version() const { return current_version_; }
65 void set_current_version(const base::Version& current_version) {
66 current_version_ = current_version;
69 std::string current_fingerprint() const { return current_fingerprint_; }
71 void set_current_fingerprint(const std::string& current_fingerprint) {
72 current_fingerprint_ = current_fingerprint;
75 ComponentUpdateService* cus() const { return cus_; }
79 bool updates_disabled_;
80 scoped_ptr<PnaclProfileObserver> profile_observer_;
81 base::FilePath current_profile_path_;
82 base::Version current_version_;
83 std::string current_fingerprint_;
84 ComponentUpdateService* cus_;
85 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller);
88 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_