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

Unified Diff: chrome/browser/extensions/extension_storage_monitor.h

Issue 310183005: Added uninstall option to notification of high disk usage by an extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exstorage_refactor
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_storage_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_storage_monitor.h
diff --git a/chrome/browser/extensions/extension_storage_monitor.h b/chrome/browser/extensions/extension_storage_monitor.h
index a39986ea6235c8e2309b22dc4890d465f5fc06b4..6fa9c205104f00e08f599ae800f4d196e018cf39 100644
--- a/chrome/browser/extensions/extension_storage_monitor.h
+++ b/chrome/browser/extensions/extension_storage_monitor.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
+#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -35,13 +36,15 @@ class StorageEventObserver;
// usage is detected.
class ExtensionStorageMonitor : public KeyedService,
public content::NotificationObserver,
- public ExtensionRegistryObserver {
+ public ExtensionRegistryObserver,
+ public ExtensionUninstallDialog::Delegate {
public:
static ExtensionStorageMonitor* Get(content::BrowserContext* context);
// Indices of buttons in the notification. Exposed for testing.
enum ButtonIndex {
- BUTTON_DISABLE_NOTIFICATION = 0
+ BUTTON_DISABLE_NOTIFICATION = 0,
+ BUTTON_UNINSTALL
};
explicit ExtensionStorageMonitor(content::BrowserContext* context);
@@ -69,6 +72,10 @@ class ExtensionStorageMonitor : public KeyedService,
virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
const Extension* extension) OVERRIDE;
+ // Overridden from ExtensionUninstallDialog::Delegate:
+ virtual void ExtensionUninstallAccepted() OVERRIDE;
+ virtual void ExtensionUninstallCanceled() OVERRIDE;
+
std::string GetNotificationId(const std::string& extension_id);
void OnStorageThresholdExceeded(const std::string& extension_id,
@@ -88,6 +95,9 @@ class ExtensionStorageMonitor : public KeyedService,
void RemoveNotificationForExtension(const std::string& extension_id);
void RemoveAllNotifications();
+ // Displays the prompt for uninstalling the extension.
+ void ShowUninstallPrompt(const std::string& extension_id);
+
// Returns/sets the next threshold for displaying a notification if an
// extension or app consumes excessive disk space.
int64 GetNextStorageThreshold(const std::string& extension_id) const;
@@ -132,6 +142,13 @@ class ExtensionStorageMonitor : public KeyedService,
// StorageEventObserver monitors storage for extensions on the IO thread.
scoped_refptr<StorageEventObserver> storage_observer_;
+ // Modal dialog used to confirm removal of an extension.
+ scoped_ptr<ExtensionUninstallDialog> uninstall_dialog_;
+
+ // The ID of the extension that is the subject of the uninstall confirmation
+ // dialog.
+ std::string uninstall_extension_id_;
+
base::WeakPtrFactory<ExtensionStorageMonitor> weak_ptr_factory_;
friend class StorageEventObserver;
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_storage_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698