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_ |