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 10 matching lines...) Expand all Loading... |
27 : views::BubbleDialogDelegateView(anchor_view, | 28 : views::BubbleDialogDelegateView(anchor_view, |
28 views::BubbleBorder::TOP_RIGHT), | 29 views::BubbleBorder::TOP_RIGHT), |
29 delegate_(std::move(delegate)), | 30 delegate_(std::move(delegate)), |
30 delegate_notified_of_close_(false), | 31 delegate_notified_of_close_(false), |
31 item_list_(nullptr), | 32 item_list_(nullptr), |
32 link_(nullptr), | 33 link_(nullptr), |
33 anchored_to_action_(anchored_to_action) { | 34 anchored_to_action_(anchored_to_action) { |
34 set_close_on_deactivate(delegate_->ShouldCloseOnDeactivate()); | 35 set_close_on_deactivate(delegate_->ShouldCloseOnDeactivate()); |
35 if (!anchor_view) | 36 if (!anchor_view) |
36 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); | 37 SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); |
| 38 chrome::RecordDialogCreation(chrome::DialogIdentifier::TOOLBAR_ACTIONS_BAR); |
37 } | 39 } |
38 | 40 |
39 ToolbarActionsBarBubbleViews::~ToolbarActionsBarBubbleViews() {} | 41 ToolbarActionsBarBubbleViews::~ToolbarActionsBarBubbleViews() {} |
40 | 42 |
41 void ToolbarActionsBarBubbleViews::Show() { | 43 void ToolbarActionsBarBubbleViews::Show() { |
42 delegate_->OnBubbleShown(); | 44 delegate_->OnBubbleShown(); |
43 GetWidget()->Show(); | 45 GetWidget()->Show(); |
44 } | 46 } |
45 | 47 |
46 views::View* ToolbarActionsBarBubbleViews::CreateExtraView() { | 48 views::View* ToolbarActionsBarBubbleViews::CreateExtraView() { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int event_flags) { | 172 int event_flags) { |
171 DCHECK(!delegate_notified_of_close_); | 173 DCHECK(!delegate_notified_of_close_); |
172 delegate_notified_of_close_ = true; | 174 delegate_notified_of_close_ = true; |
173 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE); | 175 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE); |
174 // Note that the Widget may or may not already be closed at this point, | 176 // Note that the Widget may or may not already be closed at this point, |
175 // depending on delegate_->ShouldCloseOnDeactivate(). Widget::Close() protects | 177 // depending on delegate_->ShouldCloseOnDeactivate(). Widget::Close() protects |
176 // against multiple calls (so long as they are not nested), and Widget | 178 // against multiple calls (so long as they are not nested), and Widget |
177 // destruction is asynchronous, so it is safe to call Close() again. | 179 // destruction is asynchronous, so it is safe to call Close() again. |
178 GetWidget()->Close(); | 180 GetWidget()->Close(); |
179 } | 181 } |
OLD | NEW |