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 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" |
6 | 6 |
| 7 #include "chrome/browser/ui/browser_dialogs.h" |
7 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
8 #include "chrome/grit/locale_settings.h" | 9 #include "chrome/grit/locale_settings.h" |
9 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/color_palette.h" | 11 #include "ui/gfx/color_palette.h" |
11 #include "ui/gfx/paint_vector_icon.h" | 12 #include "ui/gfx/paint_vector_icon.h" |
12 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
13 #include "ui/views/controls/image_view.h" | 14 #include "ui/views/controls/image_view.h" |
14 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
15 #include "ui/views/controls/link.h" | 16 #include "ui/views/controls/link.h" |
16 #include "ui/views/layout/box_layout.h" | 17 #include "ui/views/layout/box_layout.h" |
(...skipping 11 matching lines...) Expand all Loading... |
28 views::BubbleBorder::TOP_RIGHT), | 29 views::BubbleBorder::TOP_RIGHT), |
29 delegate_(std::move(delegate)), | 30 delegate_(std::move(delegate)), |
30 close_reason_( | 31 close_reason_( |
31 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION), | 32 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION), |
32 item_list_(nullptr), | 33 item_list_(nullptr), |
33 link_(nullptr), | 34 link_(nullptr), |
34 anchored_to_action_(anchored_to_action) { | 35 anchored_to_action_(anchored_to_action) { |
35 set_close_on_deactivate(delegate_->ShouldCloseOnDeactivate()); | 36 set_close_on_deactivate(delegate_->ShouldCloseOnDeactivate()); |
36 if (!anchor_view) | 37 if (!anchor_view) |
37 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | 38 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); |
| 39 chrome::RecordDialogCreation(chrome::DialogIdentifier::TOOLBAR_ACTIONS_BAR); |
38 } | 40 } |
39 | 41 |
40 ToolbarActionsBarBubbleViews::~ToolbarActionsBarBubbleViews() {} | 42 ToolbarActionsBarBubbleViews::~ToolbarActionsBarBubbleViews() {} |
41 | 43 |
42 void ToolbarActionsBarBubbleViews::Show() { | 44 void ToolbarActionsBarBubbleViews::Show() { |
43 delegate_->OnBubbleShown(); | 45 delegate_->OnBubbleShown(); |
44 GetWidget()->Show(); | 46 GetWidget()->Show(); |
45 } | 47 } |
46 | 48 |
47 views::View* ToolbarActionsBarBubbleViews::CreateExtraView() { | 49 views::View* ToolbarActionsBarBubbleViews::CreateExtraView() { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ui::DialogButton button) const { | 157 ui::DialogButton button) const { |
156 return button == ui::DIALOG_BUTTON_OK ? delegate_->GetActionButtonText() | 158 return button == ui::DIALOG_BUTTON_OK ? delegate_->GetActionButtonText() |
157 : delegate_->GetDismissButtonText(); | 159 : delegate_->GetDismissButtonText(); |
158 } | 160 } |
159 | 161 |
160 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link, | 162 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link, |
161 int event_flags) { | 163 int event_flags) { |
162 close_reason_ = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE; | 164 close_reason_ = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE; |
163 GetWidget()->Close(); | 165 GetWidget()->Close(); |
164 } | 166 } |
OLD | NEW |