Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/browser/component_updater/pnacl/pnacl_component_installer.h

Issue 17001003: Replace early check for PNaCl with an on-demand check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/component_updater/pnacl/pnacl_component_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <list>
9 9
10 #include "base/callback_forward.h"
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/version.h" 14 #include "base/version.h"
14 #include "chrome/browser/component_updater/component_updater_service.h" 15 #include "chrome/browser/component_updater/component_updater_service.h"
15 #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"
16 18
17 class CommandLine; 19 class CommandLine;
18 20
19 namespace base { 21 namespace base {
20 class DictionaryValue; 22 class DictionaryValue;
21 } 23 }
22 24
23 // Component installer responsible for Portable Native Client files. 25 // Component installer responsible for Portable Native Client files.
24 // Files can be installed to a shared location, or be installed to 26 // Files can be installed to a shared location, or be installed to
25 // a per-user location. 27 // a per-user location.
(...skipping 26 matching lines...) Expand all
52 54
53 // Determine the base directory for storing each version of PNaCl. 55 // Determine the base directory for storing each version of PNaCl.
54 base::FilePath GetPnaclBaseDirectory(); 56 base::FilePath GetPnaclBaseDirectory();
55 57
56 base::Version current_version() const { return current_version_; } 58 base::Version current_version() const { return current_version_; }
57 59
58 void set_current_version(const base::Version& v) { current_version_ = v; } 60 void set_current_version(const base::Version& v) { current_version_ = v; }
59 61
60 ComponentUpdateService* cus() const { return cus_; } 62 ComponentUpdateService* cus() const { return cus_; }
61 63
64 typedef base::Callback<void(bool)> InstallCallback;
65 void AddInstallCallback(const InstallCallback& cb);
66
67 void NotifyInstallError();
68
69 void NotifyInstallSuccess();
70
62 private: 71 private:
72 // Cancel a particular callback after a timeout.
73 void CancelCallback(int callback_num);
74
75 void NotifyAllWithResult(bool status);
76
63 bool per_user_; 77 bool per_user_;
64 scoped_ptr<PnaclProfileObserver> profile_observer_; 78 scoped_ptr<PnaclProfileObserver> profile_observer_;
65 base::FilePath current_profile_path_; 79 base::FilePath current_profile_path_;
66 base::Version current_version_; 80 base::Version current_version_;
67 ComponentUpdateService* cus_; 81 ComponentUpdateService* cus_;
82 // Counter to issue identifiers to each callback.
83 int callback_nums_;
84 // List of callbacks to issue when an install completes successfully.
85 std::list<std::pair<InstallCallback, int> > install_callbacks_;
86 // Component updater service observer, to determine when an on-demand
87 // install request failed.
88 scoped_ptr<PnaclUpdaterObserver> updater_observer_;
68 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); 89 DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller);
69 }; 90 };
70 91
71 // Returns true if this browser is compatible with the given Pnacl component 92 // Returns true if this browser is compatible with the given Pnacl component
72 // manifest, with the version specified in the manifest in |version_out|. 93 // manifest, with the version specified in the manifest in |version_out|.
73 bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest, 94 bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
74 base::Version* version_out); 95 base::Version* version_out);
75 96
97 // Ask the given component updater service to do a first-install for PNaCl.
98 // The |installed| callback will be run with |true| on success,
99 // or run with |false| on an error. The callback is called on the UI thread.
100 void RequestFirstInstall(ComponentUpdateService* cus,
101 PnaclComponentInstaller* pci,
102 const base::Callback<void(bool)>& installed);
103
76 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ 104 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/pnacl/pnacl_component_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698