Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
|
benwells
2015/12/07 10:49:05
I don't believe this functionality is used at all
Devlin
2015/12/07 16:53:59
I thought we used it for anything with the unlimit
| |
| 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 | 58 |
| 59 // ExtensionRegistryObserver overrides: | 59 // ExtensionRegistryObserver overrides: |
| 60 void OnExtensionLoaded(content::BrowserContext* browser_context, | 60 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 61 const Extension* extension) override; | 61 const Extension* extension) override; |
| 62 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 62 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 63 const Extension* extension, | 63 const Extension* extension, |
| 64 UnloadedExtensionInfo::Reason reason) override; | 64 UnloadedExtensionInfo::Reason reason) override; |
| 65 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, | 65 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, |
| 66 const Extension* extension, | 66 const Extension* extension, |
| 67 bool is_update, | 67 bool is_update, |
| 68 bool from_ephemeral, | |
| 69 const std::string& old_name) override; | 68 const std::string& old_name) override; |
| 70 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 69 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 71 const Extension* extension, | 70 const Extension* extension, |
| 72 extensions::UninstallReason reason) override; | 71 extensions::UninstallReason reason) override; |
| 73 | 72 |
| 74 // Overridden from ExtensionUninstallDialog::Delegate: | 73 // Overridden from ExtensionUninstallDialog::Delegate: |
| 75 void OnExtensionUninstallDialogClosed(bool did_start_uninstall, | 74 void OnExtensionUninstallDialogClosed(bool did_start_uninstall, |
| 76 const base::string16& error) override; | 75 const base::string16& error) override; |
| 77 | 76 |
| 78 std::string GetNotificationId(const std::string& extension_id); | 77 std::string GetNotificationId(const std::string& extension_id); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 // consumes too much disk space. | 110 // consumes too much disk space. |
| 112 bool IsStorageNotificationEnabled(const std::string& extension_id) const; | 111 bool IsStorageNotificationEnabled(const std::string& extension_id) const; |
| 113 void SetStorageNotificationEnabled(const std::string& extension_id, | 112 void SetStorageNotificationEnabled(const std::string& extension_id, |
| 114 bool enable_notifications); | 113 bool enable_notifications); |
| 115 | 114 |
| 116 // Initially, monitoring will only be applied to ephemeral apps. This flag | 115 // Initially, monitoring will only be applied to ephemeral apps. This flag |
| 117 // is set by tests to enable for all extensions and apps. | 116 // is set by tests to enable for all extensions and apps. |
| 118 bool enable_for_all_extensions_; | 117 bool enable_for_all_extensions_; |
| 119 | 118 |
| 120 // The first notification is shown after the initial threshold is exceeded. | 119 // The first notification is shown after the initial threshold is exceeded. |
| 121 // Ephemeral apps have a lower threshold than fully installed extensions. | |
| 122 // A lower threshold is set by tests. | 120 // A lower threshold is set by tests. |
| 123 int64 initial_extension_threshold_; | 121 int64 initial_extension_threshold_; |
| 124 int64 initial_ephemeral_threshold_; | |
| 125 | 122 |
| 126 // The rate at which we would like to receive storage updates | 123 // The rate at which we would like to receive storage updates |
| 127 // from QuotaManager. Overridden in tests. | 124 // from QuotaManager. Overridden in tests. |
| 128 base::TimeDelta observer_rate_; | 125 base::TimeDelta observer_rate_; |
| 129 | 126 |
| 130 // IDs of extensions that notifications were shown for. | 127 // IDs of extensions that notifications were shown for. |
| 131 std::set<std::string> notified_extension_ids_; | 128 std::set<std::string> notified_extension_ids_; |
| 132 | 129 |
| 133 content::BrowserContext* context_; | 130 content::BrowserContext* context_; |
| 134 extensions::ExtensionPrefs* extension_prefs_; | 131 extensions::ExtensionPrefs* extension_prefs_; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 152 | 149 |
| 153 friend class StorageEventObserver; | 150 friend class StorageEventObserver; |
| 154 friend class ExtensionStorageMonitorTest; | 151 friend class ExtensionStorageMonitorTest; |
| 155 | 152 |
| 156 DISALLOW_COPY_AND_ASSIGN(ExtensionStorageMonitor); | 153 DISALLOW_COPY_AND_ASSIGN(ExtensionStorageMonitor); |
| 157 }; | 154 }; |
| 158 | 155 |
| 159 } // namespace extensions | 156 } // namespace extensions |
| 160 | 157 |
| 161 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_ | 158 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_STORAGE_MONITOR_H_ |
| OLD | NEW |