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

Side by Side Diff: chrome/browser/extensions/extension_storage_monitor.h

Issue 2923663002: ExtensionStorageMonitor: use smaller, self-registering StorageObservers (Closed)
Patch Set: Remove lame comment. Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_storage_monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 14 matching lines...) Expand all
25 25
26 namespace gfx { 26 namespace gfx {
27 class Image; 27 class Image;
28 } 28 }
29 29
30 namespace extensions { 30 namespace extensions {
31 31
32 class Extension; 32 class Extension;
33 class ExtensionPrefs; 33 class ExtensionPrefs;
34 class ExtensionRegistry; 34 class ExtensionRegistry;
35 class StorageEventObserver; 35 class ExtensionStorageMonitorIOHelper;
36 36
37 // ExtensionStorageMonitor monitors the storage usage of extensions and apps 37 // ExtensionStorageMonitor monitors the storage usage of extensions and apps
38 // that are granted unlimited storage and displays notifications when high 38 // that are granted unlimited storage and displays notifications when high
39 // usage is detected. 39 // usage is detected.
40 class ExtensionStorageMonitor : public KeyedService, 40 class ExtensionStorageMonitor : public KeyedService,
41 public content::NotificationObserver, 41 public content::NotificationObserver,
42 public ExtensionRegistryObserver, 42 public ExtensionRegistryObserver,
43 public ExtensionUninstallDialog::Delegate { 43 public ExtensionUninstallDialog::Delegate {
44 public: 44 public:
45 static ExtensionStorageMonitor* Get(content::BrowserContext* context); 45 static ExtensionStorageMonitor* Get(content::BrowserContext* context);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 std::set<std::string> notified_extension_ids_; 132 std::set<std::string> notified_extension_ids_;
133 133
134 content::BrowserContext* context_; 134 content::BrowserContext* context_;
135 extensions::ExtensionPrefs* extension_prefs_; 135 extensions::ExtensionPrefs* extension_prefs_;
136 136
137 content::NotificationRegistrar registrar_; 137 content::NotificationRegistrar registrar_;
138 ScopedObserver<extensions::ExtensionRegistry, 138 ScopedObserver<extensions::ExtensionRegistry,
139 extensions::ExtensionRegistryObserver> 139 extensions::ExtensionRegistryObserver>
140 extension_registry_observer_; 140 extension_registry_observer_;
141 141
142 // StorageEventObserver monitors storage for extensions on the IO thread. 142 // ExtensionStorageMonitorIOHelper maintains, on the IO thread, an instance of
143 scoped_refptr<StorageEventObserver> storage_observer_; 143 // SingleExtensionStorageObserver for each extension.
144 scoped_refptr<ExtensionStorageMonitorIOHelper> io_helper_;
144 145
145 // Modal dialog used to confirm removal of an extension. 146 // Modal dialog used to confirm removal of an extension.
146 std::unique_ptr<ExtensionUninstallDialog> uninstall_dialog_; 147 std::unique_ptr<ExtensionUninstallDialog> uninstall_dialog_;
147 148
148 // The ID of the extension that is the subject of the uninstall confirmation 149 // The ID of the extension that is the subject of the uninstall confirmation
149 // dialog. 150 // dialog.
150 std::string uninstall_extension_id_; 151 std::string uninstall_extension_id_;
151 152
152 base::WeakPtrFactory<ExtensionStorageMonitor> weak_ptr_factory_; 153 base::WeakPtrFactory<ExtensionStorageMonitor> weak_ptr_factory_;
153 154
154 friend class StorageEventObserver; 155 friend class SingleExtensionStorageObserver;
155 friend class ExtensionStorageMonitorTest; 156 friend class ExtensionStorageMonitorTest;
156 157
157 DISALLOW_COPY_AND_ASSIGN(ExtensionStorageMonitor); 158 DISALLOW_COPY_AND_ASSIGN(ExtensionStorageMonitor);
158 }; 159 };
159 160
160 } // namespace extensions 161 } // namespace extensions
161 162
162 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_ 163 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_storage_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698