| 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_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 10 #include "chrome/browser/extensions/extension_message_bubble.h" | 10 #include "chrome/browser/extensions/extension_message_bubble.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 class Delegate { | 31 class Delegate { |
| 32 public: | 32 public: |
| 33 virtual bool ShouldIncludeExtension(const std::string& extension_id) = 0; | 33 virtual bool ShouldIncludeExtension(const std::string& extension_id) = 0; |
| 34 virtual void AcknowledgeExtension( | 34 virtual void AcknowledgeExtension( |
| 35 const std::string& extension_id, | 35 const std::string& extension_id, |
| 36 BubbleAction action) = 0; | 36 BubbleAction action) = 0; |
| 37 virtual void PerformAction(const ExtensionIdList& list) = 0; | 37 virtual void PerformAction(const ExtensionIdList& list) = 0; |
| 38 | 38 |
| 39 // Text for various UI labels shown in the bubble. | 39 // Text for various UI labels shown in the bubble. |
| 40 virtual string16 GetTitle() const = 0; | 40 virtual base::string16 GetTitle() const = 0; |
| 41 virtual string16 GetMessageBody() const = 0; | 41 virtual base::string16 GetMessageBody() const = 0; |
| 42 virtual string16 GetOverflowText(const string16& overflow_count) const = 0; | 42 virtual base::string16 GetOverflowText( |
| 43 virtual string16 GetLearnMoreLabel() const = 0; | 43 const base::string16& overflow_count) const = 0; |
| 44 virtual base::string16 GetLearnMoreLabel() const = 0; |
| 44 virtual GURL GetLearnMoreUrl() const = 0; | 45 virtual GURL GetLearnMoreUrl() const = 0; |
| 45 virtual string16 GetActionButtonLabel() const = 0; | 46 virtual base::string16 GetActionButtonLabel() const = 0; |
| 46 virtual string16 GetDismissButtonLabel() const = 0; | 47 virtual base::string16 GetDismissButtonLabel() const = 0; |
| 47 | 48 |
| 48 // Whether to show a list of extensions in the bubble. | 49 // Whether to show a list of extensions in the bubble. |
| 49 virtual bool ShouldShowExtensionList() const = 0; | 50 virtual bool ShouldShowExtensionList() const = 0; |
| 50 // The data to show in the bubble. | 51 // The data to show in the bubble. |
| 51 virtual std::vector<string16> GetExtensions() = 0; | 52 virtual std::vector<base::string16> GetExtensions() = 0; |
| 52 | 53 |
| 53 // Record, through UMA, how many extensions were found. | 54 // Record, through UMA, how many extensions were found. |
| 54 virtual void LogExtensionCount(size_t count) = 0; | 55 virtual void LogExtensionCount(size_t count) = 0; |
| 55 virtual void LogAction(BubbleAction action) = 0; | 56 virtual void LogAction(BubbleAction action) = 0; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 ExtensionMessageBubbleController(Delegate* delegate, Profile* profile); | 59 ExtensionMessageBubbleController(Delegate* delegate, Profile* profile); |
| 59 virtual ~ExtensionMessageBubbleController(); | 60 virtual ~ExtensionMessageBubbleController(); |
| 60 | 61 |
| 61 // Whether the controller knows of extensions to list in the bubble. Returns | 62 // Whether the controller knows of extensions to list in the bubble. Returns |
| 62 // true if so. | 63 // true if so. |
| 63 bool ShouldShow(); | 64 bool ShouldShow(); |
| 64 | 65 |
| 65 // Obtains a list of all extensions (by name) the controller knows about. | 66 // Obtains a list of all extensions (by name) the controller knows about. |
| 66 std::vector<string16> GetExtensionList(); | 67 std::vector<base::string16> GetExtensionList(); |
| 67 | 68 |
| 68 // Obtains a list of all extensions (by id) the controller knows about. | 69 // Obtains a list of all extensions (by id) the controller knows about. |
| 69 const ExtensionIdList& GetExtensionIdList(); | 70 const ExtensionIdList& GetExtensionIdList(); |
| 70 | 71 |
| 71 // Sets up the callbacks and shows the bubble. | 72 // Sets up the callbacks and shows the bubble. |
| 72 void Show(ExtensionMessageBubble* bubble); | 73 void Show(ExtensionMessageBubble* bubble); |
| 73 | 74 |
| 74 // Callbacks from bubble. Declared virtual for testing purposes. | 75 // Callbacks from bubble. Declared virtual for testing purposes. |
| 75 virtual void OnBubbleAction(); | 76 virtual void OnBubbleAction(); |
| 76 virtual void OnBubbleDismiss(); | 77 virtual void OnBubbleDismiss(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 // This object only checks once for suspicious extensions because the dataset | 103 // This object only checks once for suspicious extensions because the dataset |
| 103 // doesn't change after startup. | 104 // doesn't change after startup. |
| 104 bool has_notified_; | 105 bool has_notified_; |
| 105 | 106 |
| 106 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController); | 107 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleController); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 } // namespace extensions | 110 } // namespace extensions |
| 110 | 111 |
| 111 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |