Remove keyboard_ui.css and manifest_keyboard.json
[chromium-blink-merge.git] / chrome / browser / extensions / active_install_data.h
blob4aa5887791eaa36e5a60145d9265707eedad094d
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/scoped_observer.h"
12 #include "chrome/browser/extensions/install_observer.h"
14 namespace extensions {
16 class InstallTracker;
18 // Details of an active extension install.
19 struct ActiveInstallData {
20 public:
21 ActiveInstallData();
22 explicit ActiveInstallData(const std::string& extension_id);
24 std::string extension_id;
25 int percent_downloaded;
26 bool is_ephemeral;
29 // Registers and deregisters and an active extension install with the
30 // InstallTracker.
31 class ScopedActiveInstall : public InstallObserver {
32 public:
33 // This constructor registers an active install with the InstallTracker.
34 ScopedActiveInstall(InstallTracker* tracker,
35 const ActiveInstallData& install_data);
37 // This constructor does not register an active install. The extension install
38 // is still deregistered upon destruction.
39 ScopedActiveInstall(InstallTracker* tracker, const std::string& extension_id);
41 ~ScopedActiveInstall() override;
43 // Ensures that the active install is not deregistered upon destruction. This
44 // may be necessary if the extension install outlives the lifetime of this
45 // instance.
46 void CancelDeregister();
48 private:
49 void Init();
51 // InstallObserver implementation.
52 void OnShutdown() override;
54 InstallTracker* tracker_;
55 ScopedObserver<InstallTracker, InstallObserver> tracker_observer_;
56 std::string extension_id_;
58 DISALLOW_COPY_AND_ASSIGN(ScopedActiveInstall);
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_INSTALL_DATA_H_