| 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_delegate.h" | 11 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 12 #include "ui/views/controls/button/button.h" | |
| 13 | 12 |
| 14 class Profile; | 13 class Profile; |
| 15 class ToolbarActionsBarBubbleDelegate; | 14 class ToolbarActionsBarBubbleDelegate; |
| 16 class ToolbarActionsBarBubbleViewsUnitTest; | 15 class ToolbarActionsBarBubbleViewsUnitTest; |
| 17 | 16 |
| 18 namespace views { | 17 namespace views { |
| 19 class Label; | 18 class Label; |
| 20 class LabelButton; | 19 class LabelButton; |
| 21 } | 20 } |
| 22 | 21 |
| 23 // TODO(devlin): It might be best for this to combine with | 22 // TODO(devlin): It might be best for this to combine with |
| 24 // ExtensionMessageBubbleView, similar to what we do on Mac. | 23 // ExtensionMessageBubbleView, similar to what we do on Mac. |
| 25 class ToolbarActionsBarBubbleViews : public views::BubbleDelegateView, | 24 class ToolbarActionsBarBubbleViews : public views::BubbleDialogDelegateView { |
| 26 public views::ButtonListener { | |
| 27 public: | 25 public: |
| 28 ToolbarActionsBarBubbleViews( | 26 ToolbarActionsBarBubbleViews( |
| 29 views::View* anchor_view, | 27 views::View* anchor_view, |
| 30 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate); | 28 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate); |
| 31 ~ToolbarActionsBarBubbleViews() override; | 29 ~ToolbarActionsBarBubbleViews() override; |
| 32 | 30 |
| 33 void Show(); | 31 void Show(); |
| 34 | 32 |
| 35 const views::Label* heading_label() const { return heading_label_; } | |
| 36 const views::Label* content_label() const { return content_label_; } | |
| 37 const views::LabelButton* action_button() const { return action_button_; } | |
| 38 const views::LabelButton* dismiss_button() const { return dismiss_button_; } | |
| 39 | |
| 40 private: | 33 private: |
| 41 // views::BubbleDelegateView: | 34 // views::BubbleDialogDelegateView: |
| 35 base::string16 GetWindowTitle() const override; |
| 36 bool Cancel() override; |
| 37 bool Accept() override; |
| 38 bool Close() override; |
| 39 int GetDialogButtons() const override; |
| 40 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 42 void Init() override; | 41 void Init() override; |
| 43 void OnWidgetDestroying(views::Widget* widget) override; | |
| 44 | |
| 45 // views::ButtonListener: | |
| 46 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 47 | |
| 48 views::View* anchor_view_; | |
| 49 | 42 |
| 50 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_; | 43 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_; |
| 51 | 44 |
| 52 views::Label* heading_label_; | |
| 53 views::Label* content_label_; | |
| 54 | |
| 55 views::LabelButton* dismiss_button_; | |
| 56 views::LabelButton* action_button_; | |
| 57 | |
| 58 // Whether or not the user acknowledged the bubble by clicking the "ok" | |
| 59 // button. | |
| 60 bool acknowledged_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews); | 45 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViews); |
| 63 }; | 46 }; |
| 64 | 47 |
| 65 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ | 48 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_H_ |
| OLD | NEW |