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> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
11 | 12 |
12 // 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. |
13 class TestToolbarActionsBarBubbleDelegate { | 14 class TestToolbarActionsBarBubbleDelegate { |
14 public: | 15 public: |
15 TestToolbarActionsBarBubbleDelegate( | 16 TestToolbarActionsBarBubbleDelegate( |
16 const base::string16& heading, | 17 const base::string16& heading, |
17 const base::string16& body, | 18 const base::string16& body, |
18 const base::string16& action); | 19 const base::string16& action); |
19 ~TestToolbarActionsBarBubbleDelegate(); | 20 ~TestToolbarActionsBarBubbleDelegate(); |
20 | 21 |
21 // 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 |
22 // 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 |
23 // it would be deleted once the bubble closes. | 24 // it would be deleted once the bubble closes. |
24 scoped_ptr<ToolbarActionsBarBubbleDelegate> GetDelegate(); | 25 std::unique_ptr<ToolbarActionsBarBubbleDelegate> GetDelegate(); |
25 | 26 |
26 void set_dismiss_button_text(const base::string16& dismiss) { | 27 void set_dismiss_button_text(const base::string16& dismiss) { |
27 dismiss_ = dismiss; | 28 dismiss_ = dismiss; |
28 } | 29 } |
29 void set_learn_more_button_text(const base::string16& learn_more) { | 30 void set_learn_more_button_text(const base::string16& learn_more) { |
30 learn_more_ = learn_more; | 31 learn_more_ = learn_more; |
31 } | 32 } |
32 void set_item_list_text(const base::string16& item_list) { | 33 void set_item_list_text(const base::string16& item_list) { |
33 item_list_ = item_list; | 34 item_list_ = item_list; |
34 } | 35 } |
35 | 36 |
36 const ToolbarActionsBarBubbleDelegate::CloseAction* close_action() const { | 37 const ToolbarActionsBarBubbleDelegate::CloseAction* close_action() const { |
37 return close_action_.get(); | 38 return close_action_.get(); |
38 } | 39 } |
39 bool shown() const { return shown_; } | 40 bool shown() const { return shown_; } |
40 | 41 |
41 private: | 42 private: |
42 class DelegateImpl; | 43 class DelegateImpl; |
43 | 44 |
44 // Whether or not the bubble has been shown. | 45 // Whether or not the bubble has been shown. |
45 bool shown_; | 46 bool shown_; |
46 | 47 |
47 // The action that was taken to close the bubble. | 48 // The action that was taken to close the bubble. |
48 scoped_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> close_action_; | 49 std::unique_ptr<ToolbarActionsBarBubbleDelegate::CloseAction> close_action_; |
49 | 50 |
50 // Strings for the bubble. | 51 // Strings for the bubble. |
51 base::string16 heading_; | 52 base::string16 heading_; |
52 base::string16 body_; | 53 base::string16 body_; |
53 base::string16 action_; | 54 base::string16 action_; |
54 base::string16 dismiss_; | 55 base::string16 dismiss_; |
55 base::string16 learn_more_; | 56 base::string16 learn_more_; |
56 base::string16 item_list_; | 57 base::string16 item_list_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionsBarBubbleDelegate); | 59 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionsBarBubbleDelegate); |
59 }; | 60 }; |
60 | 61 |
61 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ | 62 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTIONS_BAR_BUBBLE_DELEGATE_H_ |
OLD | NEW |