| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 | 11 |
| 12 // A delegate for a generic bubble that hangs off the toolbar actions bar. | 12 // A delegate for a generic bubble that hangs off the toolbar actions bar. |
| 13 class ToolbarActionsBarBubbleDelegate { | 13 class ToolbarActionsBarBubbleDelegate { |
| 14 public: | 14 public: |
| 15 enum CloseAction { | 15 enum CloseAction { |
| 16 CLOSE_LEARN_MORE, | 16 CLOSE_LEARN_MORE, |
| 17 CLOSE_EXECUTE, | 17 CLOSE_EXECUTE, |
| 18 CLOSE_DISMISS_USER_ACTION, | 18 CLOSE_DISMISS_USER_ACTION, |
| 19 CLOSE_DISMISS_DEACTIVATION, | 19 CLOSE_DISMISS_DEACTIVATION, |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 virtual ~ToolbarActionsBarBubbleDelegate() {} | 22 virtual ~ToolbarActionsBarBubbleDelegate() {} |
| 23 | 23 |
| 24 // Returns true if the bubble should (still) be shown. Since bubbles are |
| 25 // sometimes shown asynchronously, they may be invalid by the time they would |
| 26 // be displayed. |
| 27 virtual bool ShouldShow() = 0; |
| 28 |
| 29 // Returns true if the bubble should close on deactivation. |
| 30 virtual bool ShouldCloseOnDeactivate() = 0; |
| 31 |
| 24 // Gets the text for the bubble's heading (title). | 32 // Gets the text for the bubble's heading (title). |
| 25 virtual base::string16 GetHeadingText() = 0; | 33 virtual base::string16 GetHeadingText() = 0; |
| 26 | 34 |
| 27 // Gets the text for the bubble's body. | 35 // Gets the text for the bubble's body. |
| 28 virtual base::string16 GetBodyText() = 0; | 36 // |anchored_to_action| is true if the bubble is being anchored to a specific |
| 37 // action (rather than the overflow menu or the full container). |
| 38 virtual base::string16 GetBodyText(bool anchored_to_action) = 0; |
| 29 | 39 |
| 30 // Gets the text for an optional item list to display. If this returns an | 40 // Gets the text for an optional item list to display. If this returns an |
| 31 // empty string, no list will be added. | 41 // empty string, no list will be added. |
| 32 virtual base::string16 GetItemListText() = 0; | 42 virtual base::string16 GetItemListText() = 0; |
| 33 | 43 |
| 34 // Gets the text for the main button on the bubble; this button will | 44 // Gets the text for the main button on the bubble; this button will |
| 35 // correspond with ACTION_EXECUTE. | 45 // correspond with ACTION_EXECUTE. |
| 36 virtual base::string16 GetActionButtonText() = 0; | 46 virtual base::string16 GetActionButtonText() = 0; |
| 37 | 47 |
| 38 // Gets the text for a second button on the bubble; this button will | 48 // Gets the text for a second button on the bubble; this button will |
| 39 // correspond with ACTION_DISMISS. If this returns an empty string, no | 49 // correspond with ACTION_DISMISS. If this returns an empty string, no |
| 40 // button will be added. | 50 // button will be added. |
| 41 virtual base::string16 GetDismissButtonText() = 0; | 51 virtual base::string16 GetDismissButtonText() = 0; |
| 42 | 52 |
| 43 // Gets the text for a "learn more" link-style button on the bubble; this | 53 // Gets the text for a "learn more" link-style button on the bubble; this |
| 44 // button will correspond with ACTION_LEARN_MORE. If this returns an empty | 54 // button will correspond with ACTION_LEARN_MORE. If this returns an empty |
| 45 // string, no button will be added. | 55 // string, no button will be added. |
| 46 virtual base::string16 GetLearnMoreButtonText() = 0; | 56 virtual base::string16 GetLearnMoreButtonText() = 0; |
| 47 | 57 |
| 48 // Returns the id of the action to point to, or the empty string if the | 58 // Returns the id of the action to point to, or the empty string if the |
| 49 // bubble should point to the center of the actions container. | 59 // bubble should point to the center of the actions container. |
| 50 virtual std::string GetAnchorActionId() = 0; | 60 virtual std::string GetAnchorActionId() = 0; |
| 51 | 61 |
| 52 // Called when the bubble is shown. | 62 // Called when the bubble is shown. |
| 53 virtual void OnBubbleShown() = 0; | 63 virtual void OnBubbleShown() = 0; |
| 54 | 64 |
| 55 // Called when the bubble is closed with the type of action the user took. | 65 // Called when the bubble is closed with the type of action the user took. |
| 56 virtual void OnBubbleClosed(CloseAction action) = 0; | 66 virtual void OnBubbleClosed(CloseAction action) = 0; |
| 67 |
| 68 // Returns true if this is for an ExtensionMessageBubbleController. |
| 69 // TODO(devlin): We shouldn't need this. |
| 70 virtual bool IsExtensionMessageBubble() = 0; |
| 57 }; | 71 }; |
| 58 | 72 |
| 59 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 73 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| OLD | NEW |