OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "ui/views/bubble/bubble_dialog_delegate.h" | 11 #include "ui/views/bubble/bubble_dialog_delegate.h" |
12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/controls/link_listener.h" | 13 #include "ui/views/controls/link_listener.h" |
14 | 14 |
15 class ToolbarActionsBarBubbleDelegate; | 15 class ToolbarActionsBarBubbleDelegate; |
16 class ToolbarActionsBarBubbleViewsTest; | 16 class ToolbarActionsBarBubbleViewsTest; |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 class Label; | 19 class Label; |
20 class Link; | 20 class Link; |
21 } | 21 } |
22 | 22 |
23 class ToolbarActionsBarBubbleViews : public views::BubbleDialogDelegateView, | 23 class ToolbarActionsBarBubbleViews : public views::BubbleDialogDelegateView, |
24 public views::LinkListener { | 24 public views::LinkListener { |
25 public: | 25 public: |
| 26 // Creates the bubble anchored to |anchor_view| or, if that is null, to |
| 27 // |anchor_point| in screen coordinates. |
26 ToolbarActionsBarBubbleViews( | 28 ToolbarActionsBarBubbleViews( |
27 views::View* anchor_view, | 29 views::View* anchor_view, |
| 30 const gfx::Point& anchor_point, |
| 31 bool anchored_to_action, |
28 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate); | 32 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate); |
29 ~ToolbarActionsBarBubbleViews() override; | 33 ~ToolbarActionsBarBubbleViews() override; |
30 | 34 |
31 void Show(); | 35 void Show(); |
32 | 36 |
33 const views::Label* item_list() const { return item_list_; } | 37 const views::Label* item_list() const { return item_list_; } |
34 const views::Link* learn_more_button() const { return link_; } | 38 const views::Link* learn_more_button() const { return link_; } |
35 | 39 |
36 private: | 40 private: |
37 friend class ToolbarActionsBarBubbleViewsTest; | 41 friend class ToolbarActionsBarBubbleViewsTest; |
38 | 42 |
39 // views::BubbleDialogDelegateView: | 43 // views::BubbleDialogDelegateView: |
40 base::string16 GetWindowTitle() const override; | 44 base::string16 GetWindowTitle() const override; |
41 views::View* CreateExtraView() override; | 45 views::View* CreateExtraView() override; |
42 bool Cancel() override; | 46 bool Cancel() override; |
43 bool Accept() override; | 47 bool Accept() override; |
44 bool Close() override; | 48 bool Close() override; |
45 int GetDialogButtons() const override; | 49 int GetDialogButtons() const override; |
46 int GetDefaultDialogButton() const override; | 50 int GetDefaultDialogButton() const override; |
47 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 51 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
48 void Init() override; | 52 void Init() override; |
49 | 53 |
50 // views::LinkListener: | 54 // views::LinkListener: |
51 void LinkClicked(views::Link* source, int event_flags) override; | 55 void LinkClicked(views::Link* source, int event_flags) override; |
52 | 56 |
53 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_; | 57 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_; |
54 views::Label* item_list_; | 58 views::Label* item_list_; |
55 views::Link* link_; | 59 views::Link* link_; |
| 60 const bool anchored_to_action_; |
56 | 61 |
57 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews); | 62 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews); |
58 }; | 63 }; |
59 | 64 |
60 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ |
OLD | NEW |