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_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
| 12 | 12 |
| 13 // A test delegate for a bubble to hang off the toolbar actions bar. | 13 // A test delegate for a bubble to hang off the toolbar actions bar. |
| 14 class TestToolbarActionsBarBubbleDelegate { | 14 class TestToolbarActionsBarBubbleDelegate { |
| 15 public: | 15 public: |
| 16 TestToolbarActionsBarBubbleDelegate( | 16 TestToolbarActionsBarBubbleDelegate( |
| 17 const base::string16& heading, | 17 const base::string16& heading, |
| 18 const base::string16& body, | 18 const base::string16& body, |
| 19 const base::string16& action); | 19 const base::string16& action); |
| 20 ~TestToolbarActionsBarBubbleDelegate(); | 20 ~TestToolbarActionsBarBubbleDelegate(); |
| 21 | 21 |
| 22 // Returns a delegate to pass to the bubble. Since the bubble typically owns | 22 // Returns a delegate to pass to the bubble. Since the bubble typically owns |
| 23 // the delegate, it means we can't have this object be the delegate, because | 23 // the delegate, it means we can't have this object be the delegate, because |
| 24 // it would be deleted once the bubble closes. | 24 // it would be deleted once the bubble closes. |
| 25 std::unique_ptr<ToolbarActionsBarBubbleDelegate> GetDelegate(); | 25 std::unique_ptr<ToolbarActionsBarBubbleDelegate> GetDelegate(); |
| 26 | 26 |
| 27 void set_action_button_text(const base::string16& action) { | |
| 28 action_ = action; | |
| 29 } | |
| 27 void set_dismiss_button_text(const base::string16& dismiss) { | 30 void set_dismiss_button_text(const base::string16& dismiss) { |
| 28 dismiss_ = dismiss; | 31 dismiss_ = dismiss; |
| 29 } | 32 } |
| 30 void set_learn_more_button_text(const base::string16& learn_more) { | 33 void set_learn_more_button_text(const base::string16& learn_more) { |
| 31 learn_more_ = learn_more; | 34 learn_more_ = learn_more; |
| 35 | |
| 36 ToolbarActionsBarBubbleDelegate::ExtraViewInfo extra_view_info_linked_text; | |
| 37 extra_view_info_linked_text.text = learn_more; | |
| 38 extra_view_info_linked_text.is_text_linked = true; | |
| 39 set_extra_view_info(extra_view_info_linked_text); | |
| 32 } | 40 } |
| 33 void set_item_list_text(const base::string16& item_list) { | 41 void set_item_list_text(const base::string16& item_list) { |
| 34 item_list_ = item_list; | 42 item_list_ = item_list; |
| 35 } | 43 } |
| 36 void set_close_on_deactivate(bool close_on_deactivate) { | 44 void set_close_on_deactivate(bool close_on_deactivate) { |
| 37 close_on_deactivate_ = close_on_deactivate; | 45 close_on_deactivate_ = close_on_deactivate; |
| 38 } | 46 } |
| 47 void set_extra_view_info( | |
| 48 const ToolbarActionsBarBubbleDelegate::ExtraViewInfo& extra_view_info) { | |
| 49 extra_view_info_ = extra_view_info; | |
| 50 } | |
| 39 | 51 |
| 40 const ToolbarActionsBarBubbleDelegate::CloseAction* close_action() const { | 52 const ToolbarActionsBarBubbleDelegate::CloseAction* close_action() const { |
| 41 return close_action_.get(); | 53 return close_action_.get(); |
| 42 } | 54 } |
| 43 bool shown() const { return shown_; } | 55 bool shown() const { return shown_; } |
| 44 | 56 |
| 45 private: | 57 private: |
| 46 class DelegateImpl; | 58 class DelegateImpl; |
| 47 | 59 |
| 48 // Whether or not the bubble has been shown. | 60 // Whether or not the bubble has been shown. |
| 49 bool shown_; | 61 bool shown_; |
| 50 | 62 |
| 51 // The action that was taken to close the bubble. | 63 // The action that was taken to close the bubble. |
| 52 std::unique_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> close_action_; | 64 std::unique_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> close_action_; |
| 53 | 65 |
| 54 // Strings for the bubble. | 66 // Strings for the bubble. |
| 55 base::string16 heading_; | 67 base::string16 heading_; |
| 56 base::string16 body_; | 68 base::string16 body_; |
| 57 base::string16 action_; | 69 base::string16 action_; |
| 58 base::string16 dismiss_; | 70 base::string16 dismiss_; |
| 59 base::string16 learn_more_; | 71 base::string16 learn_more_; |
| 60 base::string16 item_list_; | 72 base::string16 item_list_; |
| 61 | 73 |
| 62 // Whether to close the bubble on deactivation. | 74 // Whether to close the bubble on deactivation. |
| 63 bool close_on_deactivate_; | 75 bool close_on_deactivate_; |
| 64 | 76 |
| 77 // Extra view information inputted into the bubble. | |
|
Devlin
2016/10/20 17:04:07
input isn't quite right here. There's no input in
catmullings
2016/10/21 03:49:29
Done.
| |
| 78 ToolbarActionsBarBubbleDelegate::ExtraViewInfo extra_view_info_; | |
| 79 | |
| 65 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionsBarBubbleDelegate); | 80 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionsBarBubbleDelegate); |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 83 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
| OLD | NEW |