Chromium Code Reviews| 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 #include "ui/gfx/vector_icons_public.h" | |
| 11 | 12 |
| 12 // A delegate for a generic bubble that hangs off the toolbar actions bar. | 13 // A delegate for a generic bubble that hangs off the toolbar actions bar. |
| 13 class ToolbarActionsBarBubbleDelegate { | 14 class ToolbarActionsBarBubbleDelegate { |
| 14 public: | 15 public: |
| 15 enum CloseAction { | 16 enum CloseAction { |
| 16 CLOSE_LEARN_MORE, | 17 CLOSE_LEARN_MORE, |
| 17 CLOSE_EXECUTE, | 18 CLOSE_EXECUTE, |
| 18 CLOSE_DISMISS_USER_ACTION, | 19 CLOSE_DISMISS_USER_ACTION, |
| 19 CLOSE_DISMISS_DEACTIVATION, | 20 CLOSE_DISMISS_DEACTIVATION, |
| 20 }; | 21 }; |
| 21 | 22 |
| 23 // Content populating an optional view, containing an image icon and/or | |
| 24 // (linked) text, in the bubble. | |
| 25 struct ExtraViewInfo { | |
| 26 ExtraViewInfo() | |
| 27 : resource_id(gfx::VectorIconId::VECTOR_ICON_NONE), | |
| 28 is_text_linked(false) {} | |
| 29 | |
| 30 // The resource id referencing the image icon. If has a value of -1, then no | |
| 31 // image icon will be added. | |
| 32 gfx::VectorIconId resource_id; | |
|
Devlin
2016/11/01 00:21:21
nit: \n
catmullings
2016/11/01 02:46:53
Done.
| |
| 33 // Text in the view. If this is an empty string, no text will be added. | |
| 34 base::string16 text; | |
|
Devlin
2016/11/01 00:21:21
nit: \n
catmullings
2016/11/01 02:46:53
Done.
| |
| 35 // If the struct's text is nonempty and this value is true, then a link of | |
| 36 // the text is added. If this value is false, the text is not treated as a | |
| 37 // link. | |
| 38 bool is_text_linked; | |
| 39 }; | |
| 40 | |
| 22 virtual ~ToolbarActionsBarBubbleDelegate() {} | 41 virtual ~ToolbarActionsBarBubbleDelegate() {} |
| 23 | 42 |
| 24 // Returns true if the bubble should (still) be shown. Since bubbles are | 43 // 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 | 44 // sometimes shown asynchronously, they may be invalid by the time they would |
| 26 // be displayed. | 45 // be displayed. |
| 27 virtual bool ShouldShow() = 0; | 46 virtual bool ShouldShow() = 0; |
| 28 | 47 |
| 29 // Returns true if the bubble should close on deactivation. | 48 // Returns true if the bubble should close on deactivation. |
| 30 virtual bool ShouldCloseOnDeactivate() = 0; | 49 virtual bool ShouldCloseOnDeactivate() = 0; |
| 31 | 50 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 57 | 76 |
| 58 // Returns the id of the action to point to, or the empty string if the | 77 // Returns the id of the action to point to, or the empty string if the |
| 59 // bubble should point to the center of the actions container. | 78 // bubble should point to the center of the actions container. |
| 60 virtual std::string GetAnchorActionId() = 0; | 79 virtual std::string GetAnchorActionId() = 0; |
| 61 | 80 |
| 62 // Called when the bubble is shown. | 81 // Called when the bubble is shown. |
| 63 virtual void OnBubbleShown() = 0; | 82 virtual void OnBubbleShown() = 0; |
| 64 | 83 |
| 65 // Called when the bubble is closed with the type of action the user took. | 84 // Called when the bubble is closed with the type of action the user took. |
| 66 virtual void OnBubbleClosed(CloseAction action) = 0; | 85 virtual void OnBubbleClosed(CloseAction action) = 0; |
| 86 | |
| 87 // Returns the ExtraViewInfo struct associated with the bubble delegate. If | |
| 88 // this returns a nullptr, no extra view (image icon and/or (linked) text) is | |
| 89 // added to the bubble. | |
| 90 virtual std::unique_ptr<ExtraViewInfo> GetExtraViewInfo() = 0; | |
| 67 }; | 91 }; |
| 68 | 92 |
| 69 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 93 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| OLD | NEW |