OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 |
| 12 class Profile; |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 // Details of an active extension install. |
| 17 struct ActiveInstallData { |
| 18 public: |
| 19 ActiveInstallData(); |
| 20 explicit ActiveInstallData(const std::string& extension_id); |
| 21 |
| 22 std::string extension_id; |
| 23 int percent_downloaded; |
| 24 bool is_ephemeral; |
| 25 }; |
| 26 |
| 27 // Registers and deregisters and an active extension install with the |
| 28 // InstallTracker. |
| 29 class ScopedActiveInstall { |
| 30 public: |
| 31 // This constructor registers an active install with the InstallTracker. |
| 32 ScopedActiveInstall(Profile* profile, const ActiveInstallData& install_data); |
| 33 |
| 34 // This constructor does not register an active install. The extension install |
| 35 // is still deregistered upon destruction. |
| 36 ScopedActiveInstall(Profile* profile, const std::string& extension_id); |
| 37 |
| 38 ~ScopedActiveInstall(); |
| 39 |
| 40 // Ensures that the active install is not deregistered upon destruction. This |
| 41 // may be necessary if the extension install outlives the lifetime of this |
| 42 // instance. |
| 43 void CancelDeregister(); |
| 44 |
| 45 private: |
| 46 Profile* profile_; |
| 47 std::string extension_id_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ScopedActiveInstall); |
| 50 }; |
| 51 |
| 52 } // namespace extensions |
| 53 |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_ |
OLD | NEW |