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

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

Issue 10696210: Making ExtensionService less dependent on Browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update based on discussion with Yoyo Created 8 years, 5 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 | « no previous file | chrome/browser/extensions/extension_error_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_error_ui.h
diff --git a/chrome/browser/extensions/extension_global_error.h b/chrome/browser/extensions/extension_error_ui.h
similarity index 58%
rename from chrome/browser/extensions/extension_global_error.h
rename to chrome/browser/extensions/extension_error_ui.h
index 7c6f428e7444b62d0723c62bec84cc7dc6bd8c49..6facea60531f2ec5b75708f9dd22c88191e20445 100644
--- a/chrome/browser/extensions/extension_global_error.h
+++ b/chrome/browser/extensions/extension_error_ui.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_UI_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_UI_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -15,10 +15,11 @@ class ExtensionService;
// This class encapsulates the UI we want to show users when certain events
// occur related to installed extensions.
-class ExtensionGlobalError : public GlobalError {
+class ExtensionErrorUI {
public:
- explicit ExtensionGlobalError(ExtensionService* extension_service);
- virtual ~ExtensionGlobalError();
+ static ExtensionErrorUI* Create(ExtensionService* extension_service);
+
+ virtual ~ExtensionErrorUI();
// Inform us that a given extension is of a certain type that the user
// hasn't yet acknowledged.
@@ -40,20 +41,32 @@ class ExtensionGlobalError : public GlobalError {
return orphaned_extension_ids_.get();
}
- // GlobalError methods.
- virtual bool HasBadge() OVERRIDE;
- virtual bool HasMenuItem() OVERRIDE;
- virtual int MenuItemCommandID() OVERRIDE;
- virtual string16 MenuItemLabel() OVERRIDE;
- virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
- virtual bool HasBubbleView() OVERRIDE;
- virtual string16 GetBubbleViewTitle() OVERRIDE;
- virtual string16 GetBubbleViewMessage() OVERRIDE;
- virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
- virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
- virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
- virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
- virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
+ // Shows the installation error in a bubble view. Should return true if a
+ // bubble is shown, false if one could not be shown.
+ virtual bool ShowErrorInBubbleView() = 0;
+
+ // Shows the extension page. Called as a result of the user clicking more
+ // info and should be only called from the context of a callback
+ // (BubbleViewDidClose or BubbleViewAccept/CancelButtonPressed).
+ // It should use the same browser as where the bubble was shown.
+ virtual void ShowExtensions() = 0;
+
+ protected:
+ explicit ExtensionErrorUI(ExtensionService* extension_service);
+
+ ExtensionService* extension_service() const { return extension_service_; }
+
+ // Model methods for the bubble view.
+ string16 GetBubbleViewTitle();
+ string16 GetBubbleViewMessage();
+ string16 GetBubbleViewAcceptButtonLabel();
+ string16 GetBubbleViewCancelButtonLabel();
+
+ // Sub-classes should call this methods based on the actions taken by the user
+ // in the error bubble.
+ void BubbleViewDidClose();
+ void BubbleViewAcceptButtonPressed();
+ void BubbleViewCancelButtonPressed();
private:
bool should_delete_self_on_close_;
@@ -71,7 +84,7 @@ class ExtensionGlobalError : public GlobalError {
// Generates the message displayed in the body of the alert.
string16 GenerateMessage();
- DISALLOW_COPY_AND_ASSIGN(ExtensionGlobalError);
+ DISALLOW_COPY_AND_ASSIGN(ExtensionErrorUI);
};
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_UI_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_error_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698