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

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

Issue 389613006: Prevent duplicate concurrent installs of the same extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed rebase 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/active_install_data.h
diff --git a/chrome/browser/extensions/active_install_data.h b/chrome/browser/extensions/active_install_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..db76d3ea2d464011b79819d22192f94a6611374d
--- /dev/null
+++ b/chrome/browser/extensions/active_install_data.h
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_
+#define CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_
+
+#include <string>
+
+#include "base/macros.h"
+
+class Profile;
+
+namespace extensions {
+
+// Details of an active extension install.
+struct ActiveInstallData {
+ public:
+ ActiveInstallData();
+ explicit ActiveInstallData(const std::string& extension_id);
+
+ std::string extension_id;
+ int percent_downloaded;
+ bool is_ephemeral;
+};
+
+// Registers and deregisters and an active extension install with the
+// InstallTracker.
+class ScopedActiveInstall {
+ public:
+ // This constructor registers an active install with the InstallTracker.
+ ScopedActiveInstall(Profile* profile, const ActiveInstallData& install_data);
+
+ // This constructor does not register an active install. The extension install
+ // is still deregistered upon destruction.
+ ScopedActiveInstall(Profile* profile, const std::string& extension_id);
+
+ ~ScopedActiveInstall();
+
+ // Ensures that the active install is not deregistered upon destruction. This
+ // may be necessary if the extension install outlives the lifetime of this
+ // instance.
+ void CancelDeregister();
+
+ private:
+ Profile* profile_;
+ std::string extension_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedActiveInstall);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698