| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_DEV_MODE_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 |
| 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 10 #include "content/public/browser/notification_observer.h" | |
| 11 #include "content/public/browser/notification_registrar.h" | |
| 12 #include "extensions/common/extension.h" | |
| 13 | |
| 14 class Browser; | |
| 15 class ExtensionService; | |
| 16 | 11 |
| 17 namespace extensions { | 12 namespace extensions { |
| 18 | 13 |
| 19 namespace { | 14 class Extension; |
| 20 | 15 |
| 21 class DevModeBubbleDelegate | 16 class DevModeBubbleController : public ExtensionMessageBubbleController { |
| 22 : public ExtensionMessageBubbleController::Delegate { | |
| 23 public: | |
| 24 explicit DevModeBubbleDelegate(Profile* profile); | |
| 25 virtual ~DevModeBubbleDelegate(); | |
| 26 | |
| 27 // ExtensionMessageBubbleController::Delegate methods. | |
| 28 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; | |
| 29 virtual void AcknowledgeExtension( | |
| 30 const std::string& extension_id, | |
| 31 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; | |
| 32 virtual void PerformAction(const ExtensionIdList& list) OVERRIDE; | |
| 33 virtual void OnClose() OVERRIDE; | |
| 34 virtual base::string16 GetTitle() const OVERRIDE; | |
| 35 virtual base::string16 GetMessageBody() const OVERRIDE; | |
| 36 virtual base::string16 GetOverflowText( | |
| 37 const base::string16& overflow_count) const OVERRIDE; | |
| 38 virtual base::string16 GetLearnMoreLabel() const OVERRIDE; | |
| 39 virtual GURL GetLearnMoreUrl() const OVERRIDE; | |
| 40 virtual base::string16 GetActionButtonLabel() const OVERRIDE; | |
| 41 virtual base::string16 GetDismissButtonLabel() const OVERRIDE; | |
| 42 virtual bool ShouldShowExtensionList() const OVERRIDE; | |
| 43 virtual void LogExtensionCount(size_t count) OVERRIDE; | |
| 44 virtual void LogAction( | |
| 45 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 // The associated profile (weak). | |
| 49 Profile* profile_; | |
| 50 | |
| 51 // Our extension service. Weak, not owned by us. | |
| 52 ExtensionService* service_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleDelegate); | |
| 55 }; | |
| 56 | |
| 57 } // namespace | |
| 58 | |
| 59 class DevModeBubble; | |
| 60 | |
| 61 class DevModeBubbleController | |
| 62 : public ExtensionMessageBubbleController { | |
| 63 public: | 17 public: |
| 64 // Clears the list of profiles the bubble has been shown for. Should only be | 18 // Clears the list of profiles the bubble has been shown for. Should only be |
| 65 // used during testing. | 19 // used during testing. |
| 66 static void ClearProfileListForTesting(); | 20 static void ClearProfileListForTesting(); |
| 67 | 21 |
| 68 // Returns true if the extension is considered a Developer Mode extension. | 22 // Returns true if the extension is considered a Developer Mode extension. |
| 69 static bool IsDevModeExtension(const Extension* extension); | 23 static bool IsDevModeExtension(const Extension* extension); |
| 70 | 24 |
| 71 explicit DevModeBubbleController(Profile* profile); | 25 explicit DevModeBubbleController(Profile* profile); |
| 72 virtual ~DevModeBubbleController(); | 26 virtual ~DevModeBubbleController(); |
| 73 | 27 |
| 74 // Whether the controller knows of extensions to list in the bubble. Returns | 28 // Whether the controller knows of extensions to list in the bubble. Returns |
| 75 // true if so. | 29 // true if so. |
| 76 bool ShouldShow(); | 30 bool ShouldShow(); |
| 77 | 31 |
| 78 // ExtensionMessageBubbleController methods. | 32 // ExtensionMessageBubbleController methods. |
| 79 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE; | 33 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE; |
| 80 | 34 |
| 81 private: | 35 private: |
| 82 // A weak pointer to the profile we are associated with. Not owned by us. | 36 // A weak pointer to the profile we are associated with. Not owned by us. |
| 83 Profile* profile_; | 37 Profile* profile_; |
| 84 | 38 |
| 85 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleController); | 39 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleController); |
| 86 }; | 40 }; |
| 87 | 41 |
| 88 } // namespace extensions | 42 } // namespace extensions |
| 89 | 43 |
| 90 #endif // CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_ | 44 #endif // CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |