Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h

Issue 1877143002: Convert ToolbarActionsBarBubbleViews to BubbleDialogDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_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 Profile; 15 class Profile;
16 class ToolbarActionsBarBubbleDelegate; 16 class ToolbarActionsBarBubbleDelegate;
17 class ToolbarActionsBarBubbleViewsUnitTest; 17 class ToolbarActionsBarBubbleViewsUnitTest;
18 18
19 namespace views { 19 namespace views {
20 class Label; 20 class Label;
21 class LabelButton; 21 class LabelButton;
22 class Link; 22 class Link;
23 } 23 }
24 24
25 // TODO(devlin): It might be best for this to combine with 25 class ToolbarActionsBarBubbleViews : public views::BubbleDialogDelegateView,
26 // ExtensionMessageBubbleView, similar to what we do on Mac.
27 class ToolbarActionsBarBubbleViews : public views::BubbleDelegateView,
28 public views::ButtonListener,
29 public views::LinkListener { 26 public views::LinkListener {
30 public: 27 public:
31 ToolbarActionsBarBubbleViews( 28 ToolbarActionsBarBubbleViews(
32 views::View* anchor_view, 29 views::View* anchor_view,
33 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate); 30 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate);
34 ~ToolbarActionsBarBubbleViews() override; 31 ~ToolbarActionsBarBubbleViews() override;
35 32
36 void Show(); 33 void Show();
37 34
38 const views::Label* heading_label() const { return heading_label_; }
39 const views::Label* content_label() const { return content_label_; }
40 const views::Label* item_list() const { return item_list_; } 35 const views::Label* item_list() const { return item_list_; }
41 const views::LabelButton* action_button() const { return action_button_; }
42 const views::LabelButton* dismiss_button() const { return dismiss_button_; }
43 const views::Link* learn_more_button() const { return learn_more_button_; } 36 const views::Link* learn_more_button() const { return learn_more_button_; }
44 37
45 private: 38 private:
46 // views::BubbleDelegateView: 39 // views::BubbleDialogDelegateView:
40 base::string16 GetWindowTitle() const override;
41 views::View* CreateExtraView() override;
42 bool Cancel() override;
43 bool Accept() override;
44 bool Close() override;
45 int GetDialogButtons() const override;
46 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
47 void Init() override; 47 void Init() override;
48 void OnWidgetDestroying(views::Widget* widget) override;
49
50 // views::ButtonListener:
51 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
52 48
53 // views::LinkListener: 49 // views::LinkListener:
54 void LinkClicked(views::Link* source, int event_flags) override; 50 void LinkClicked(views::Link* source, int event_flags) override;
55 51
56 views::View* anchor_view_;
57
58 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_; 52 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_;
59 53
60 views::Label* heading_label_;
61 views::Label* content_label_; 54 views::Label* content_label_;
62 views::Label* item_list_; 55 views::Label* item_list_;
63 56
64 views::Link* learn_more_button_; 57 views::Link* learn_more_button_;
65 views::LabelButton* dismiss_button_;
66 views::LabelButton* action_button_;
67
68 // Whether or not the user acknowledged the bubble by clicking the "ok"
69 // button.
70 bool acknowledged_;
71 58
72 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews); 59 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews);
73 }; 60 };
74 61
75 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ 62 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698