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

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

Issue 134103002: Refactor the extension message bubbles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors on non-Win platform Created 6 years, 11 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
Index: chrome/browser/extensions/dev_mode_bubble_controller.h
diff --git a/chrome/browser/extensions/dev_mode_bubble_controller.h b/chrome/browser/extensions/dev_mode_bubble_controller.h
index 3c9a60a327a13b5f72885b9141e2dc08ffc974aa..8999a350daefdb2ff517487efc2dbfce653a49ab 100644
--- a/chrome/browser/extensions/dev_mode_bubble_controller.h
+++ b/chrome/browser/extensions/dev_mode_bubble_controller.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_
#include <string>
-#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/extension_message_bubble_controller.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -19,24 +18,14 @@ namespace extensions {
class DevModeBubble;
-class DevModeBubbleController
- : public ProfileKeyedAPI,
- public ExtensionMessageBubbleController,
- public ExtensionMessageBubbleController::Delegate {
+class DevModeBubbleDelegate
not at google - send to devlin 2014/01/10 21:28:43 you could move this entire class into an anonymous
Finnur 2014/01/13 15:36:32 Done.
+ : public ExtensionMessageBubbleController::Delegate {
public:
- explicit DevModeBubbleController(Profile* profile);
- virtual ~DevModeBubbleController();
-
- // ProfileKeyedAPI implementation.
- static ProfileKeyedAPIFactory<
- DevModeBubbleController>* GetFactoryInstance();
-
- // Convenience method to get the DevModeBubbleController for a
- // profile.
- static DevModeBubbleController* Get(Profile* profile);
-
// Returns true if the extension is considered a Developer Mode extension.
- bool IsDevModeExtension(const Extension* extension) const;
+ static bool IsDevModeExtension(const Extension* extension);
+
+ explicit DevModeBubbleDelegate(Profile* profile);
+ virtual ~DevModeBubbleDelegate();
// ExtensionMessageBubbleController::Delegate methods.
virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE;
@@ -53,34 +42,43 @@ class DevModeBubbleController
virtual base::string16 GetActionButtonLabel() const OVERRIDE;
virtual base::string16 GetDismissButtonLabel() const OVERRIDE;
virtual bool ShouldShowExtensionList() const OVERRIDE;
- virtual std::vector<base::string16> GetExtensions() OVERRIDE;
virtual void LogExtensionCount(size_t count) OVERRIDE;
virtual void LogAction(
ExtensionMessageBubbleController::BubbleAction action) OVERRIDE;
private:
- friend class ProfileKeyedAPIFactory<DevModeBubbleController>;
-
- // ProfileKeyedAPI implementation.
- static const char* service_name() {
- return "DevModeBubbleController";
- }
- static const bool kServiceRedirectedInIncognito = true;
-
// Our extension service. Weak, not owned by us.
ExtensionService* service_;
+ DISALLOW_COPY_AND_ASSIGN(DevModeBubbleDelegate);
+};
+
+class DevModeBubbleController
+ : public ExtensionMessageBubbleController {
+ public:
+ explicit DevModeBubbleController(Profile* profile);
+ virtual ~DevModeBubbleController();
+
+ // Whether the controller knows of extensions to list in the bubble. Returns
+ // true if so.
+ bool ShouldShow();
+
+ // ExtensionMessageBubbleController methods.
+ virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE;
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(ExtensionMessageBubbleTest, DevModeControllerTest);
+
+ // Clears the list of profiles the bubble has been shown for. Should only be
+ // used during testing.
+ void ClearProfileListForTesting();
not at google - send to devlin 2014/01/10 21:28:43 this can be static? it may seem a little arbitrary
Finnur 2014/01/13 15:36:32 Done.
+
// A weak pointer to the profile we are associated with. Not owned by us.
Profile* profile_;
-
DISALLOW_COPY_AND_ASSIGN(DevModeBubbleController);
};
-template <>
-void ProfileKeyedAPIFactory<
- DevModeBubbleController>::DeclareFactoryDependencies();
-
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698