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

Unified Diff: chrome/browser/extensions/webstore_standalone_installer.h

Issue 389613006: Prevent duplicate concurrent installs of the same extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/webstore_standalone_installer.h
diff --git a/chrome/browser/extensions/webstore_standalone_installer.h b/chrome/browser/extensions/webstore_standalone_installer.h
index 7df7bff9f6322f76e83ccbd435849dc9c669a523..f9c271f1059f4978578e36923b5f1fbb90ba7678 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.h
+++ b/chrome/browser/extensions/webstore_standalone_installer.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
+#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/extensions/webstore_install_result.h"
@@ -64,6 +65,11 @@ class WebstoreStandaloneInstaller
// Called when the install should be aborted. The callback is cleared.
void AbortInstall();
+ // Checks InstallTracker and returns true if the same extension is not
+ // currently being installed. Registers this install with the InstallTracker.
+ bool EnsureUniqueInstall(webstore_install::Result* reason,
+ std::string* error);
+
// Called when the install is complete.
virtual void CompleteInstall(webstore_install::Result result,
const std::string& error);
@@ -78,6 +84,11 @@ class WebstoreStandaloneInstaller
// Template Method's hooks to be implemented by subclasses.
+ // Called when this install is about to be registered with the InstallTracker.
+ // Allows subclasses to set properties of the install data.
+ virtual void InitInstallData(
+ InstallTracker::InstallProgressData* install_data) const;
+
// Called at certain check points of the workflow to decide whether it makes
// sense to proceed with installation. A requestor can be a website that
// initiated an inline installation, or a command line option.
@@ -203,6 +214,7 @@ class WebstoreStandaloneInstaller
void ShowInstallUI();
void OnWebStoreDataFetcherDone();
+ void DeregisterActiveInstall();
// Input configuration.
std::string id_;
@@ -228,6 +240,9 @@ class WebstoreStandaloneInstaller
scoped_ptr<base::DictionaryValue> manifest_;
SkBitmap icon_;
+ // True if this install was registered with InstallTracker.
+ bool install_registered_;
+
// Created by ShowInstallUI() when a prompt is shown (if
// the implementor returns a non-NULL in CreateInstallPrompt()).
scoped_refptr<Extension> localized_extension_for_display_;

Powered by Google App Engine
This is Rietveld 408576698