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

Side by Side Diff: chrome/browser/extensions/webstore_installer.h

Issue 226023003: Create CrxInstaller directly in WebstoreInstaller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android compilation fix (again). Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTENSIONS_WEBSTORE_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 20 matching lines...) Expand all
31 namespace base { 31 namespace base {
32 class FilePath; 32 class FilePath;
33 } 33 }
34 34
35 namespace content { 35 namespace content {
36 class WebContents; 36 class WebContents;
37 } 37 }
38 38
39 namespace extensions { 39 namespace extensions {
40 40
41 class CrxInstaller;
41 class Extension; 42 class Extension;
42 class Manifest; 43 class Manifest;
43 44
44 // Downloads and installs extensions from the web store. 45 // Downloads and installs extensions from the web store.
45 class WebstoreInstaller : public content::NotificationObserver, 46 class WebstoreInstaller : public content::NotificationObserver,
46 public content::DownloadItem::Observer, 47 public content::DownloadItem::Observer,
47 public content::WebContentsObserver, 48 public content::WebContentsObserver,
48 public base::RefCountedThreadSafe< 49 public base::RefCountedThreadSafe<
49 WebstoreInstaller, content::BrowserThread::DeleteOnUIThread> { 50 WebstoreInstaller, content::BrowserThread::DeleteOnUIThread> {
50 public: 51 public:
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Downloads and installs a single Crx with the given |extension_id|. 222 // Downloads and installs a single Crx with the given |extension_id|.
222 // This function is used for both the extension Crx and dependences. 223 // This function is used for both the extension Crx and dependences.
223 void DownloadCrx(const std::string& extension_id, InstallSource source); 224 void DownloadCrx(const std::string& extension_id, InstallSource source);
224 225
225 // Starts downloading the extension to |file_path|. 226 // Starts downloading the extension to |file_path|.
226 void StartDownload(const base::FilePath& file_path); 227 void StartDownload(const base::FilePath& file_path);
227 228
228 // Updates the InstallTracker with the latest download progress. 229 // Updates the InstallTracker with the latest download progress.
229 void UpdateDownloadProgress(); 230 void UpdateDownloadProgress();
230 231
232 // Creates and starts CrxInstaller for the downloaded extension package.
233 void StartCrxInstaller(const content::DownloadItem& item);
234
231 // Reports an install |error| to the delegate for the given extension if this 235 // Reports an install |error| to the delegate for the given extension if this
232 // managed its installation. This also removes the associated PendingInstall. 236 // managed its installation. This also removes the associated PendingInstall.
233 void ReportFailure(const std::string& error, FailureReason reason); 237 void ReportFailure(const std::string& error, FailureReason reason);
234 238
235 // Reports a successful install to the delegate for the given extension if 239 // Reports a successful install to the delegate for the given extension if
236 // this managed its installation. This also removes the associated 240 // this managed its installation. This also removes the associated
237 // PendingInstall. 241 // PendingInstall.
238 void ReportSuccess(); 242 void ReportSuccess();
239 243
240 // Records stats regarding an interrupted webstore download item. 244 // Records stats regarding an interrupted webstore download item.
241 void RecordInterrupt(const content::DownloadItem* download) const; 245 void RecordInterrupt(const content::DownloadItem* download) const;
242 246
243 content::NotificationRegistrar registrar_; 247 content::NotificationRegistrar registrar_;
244 Profile* profile_; 248 Profile* profile_;
245 Delegate* delegate_; 249 Delegate* delegate_;
246 std::string id_; 250 std::string id_;
247 InstallSource install_source_; 251 InstallSource install_source_;
248 // The DownloadItem is owned by the DownloadManager and is valid from when 252 // The DownloadItem is owned by the DownloadManager and is valid from when
249 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed(). 253 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed().
250 content::DownloadItem* download_item_; 254 content::DownloadItem* download_item_;
251 // Used to periodically update the extension's download status. This will 255 // Used to periodically update the extension's download status. This will
252 // trigger at least every second, though sometimes more frequently (depending 256 // trigger at least every second, though sometimes more frequently (depending
253 // on number of modules, etc). 257 // on number of modules, etc).
254 base::OneShotTimer<WebstoreInstaller> download_progress_timer_; 258 base::OneShotTimer<WebstoreInstaller> download_progress_timer_;
255 scoped_ptr<Approval> approval_; 259 scoped_ptr<Approval> approval_;
256 GURL download_url_; 260 GURL download_url_;
261 scoped_refptr<CrxInstaller> crx_installer_;
257 262
258 // Pending modules. 263 // Pending modules.
259 std::list<SharedModuleInfo::ImportInfo> pending_modules_; 264 std::list<SharedModuleInfo::ImportInfo> pending_modules_;
260 // Total extension modules we need download and install (the main module and 265 // Total extension modules we need download and install (the main module and
261 // depedences). 266 // depedences).
262 int total_modules_; 267 int total_modules_;
263 bool download_started_; 268 bool download_started_;
264 }; 269 };
265 270
266 } // namespace extensions 271 } // namespace extensions
267 272
268 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ 273 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | chrome/browser/extensions/webstore_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698