OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/extension_action_platform_delegate_
views.h" | 5 #include "chrome/browser/ui/views/extensions/extension_action_platform_delegate_
views.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
9 #include "chrome/browser/extensions/extension_view_host.h" | 11 #include "chrome/browser/extensions/extension_view_host.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/extensions/accelerator_priority.h" | 14 #include "chrome/browser/ui/extensions/accelerator_priority.h" |
13 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
14 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 16 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
15 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 17 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
16 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 18 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ExtensionActionViewController::PopupShowAction show_action) { | 77 ExtensionActionViewController::PopupShowAction show_action) { |
76 // TOP_RIGHT is correct for both RTL and LTR, because the views platform | 78 // TOP_RIGHT is correct for both RTL and LTR, because the views platform |
77 // performs the flipping in RTL cases. | 79 // performs the flipping in RTL cases. |
78 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 80 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
79 | 81 |
80 views::View* reference_view = GetDelegateViews()->GetReferenceViewForPopup(); | 82 views::View* reference_view = GetDelegateViews()->GetReferenceViewForPopup(); |
81 | 83 |
82 ExtensionPopup::ShowAction popup_show_action = | 84 ExtensionPopup::ShowAction popup_show_action = |
83 show_action == ExtensionActionViewController::SHOW_POPUP ? | 85 show_action == ExtensionActionViewController::SHOW_POPUP ? |
84 ExtensionPopup::SHOW : ExtensionPopup::SHOW_AND_INSPECT; | 86 ExtensionPopup::SHOW : ExtensionPopup::SHOW_AND_INSPECT; |
85 ExtensionPopup::ShowPopup(host.Pass(), | 87 ExtensionPopup::ShowPopup(std::move(host), reference_view, arrow, |
86 reference_view, | |
87 arrow, | |
88 popup_show_action); | 88 popup_show_action); |
89 } | 89 } |
90 | 90 |
91 void ExtensionActionPlatformDelegateViews::CloseOverflowMenu() { | 91 void ExtensionActionPlatformDelegateViews::CloseOverflowMenu() { |
92 AppMenuButton* app_menu_button = | 92 AppMenuButton* app_menu_button = |
93 BrowserView::GetBrowserViewForBrowser(controller_->browser()) | 93 BrowserView::GetBrowserViewForBrowser(controller_->browser()) |
94 ->toolbar() | 94 ->toolbar() |
95 ->app_menu_button(); | 95 ->app_menu_button(); |
96 if (app_menu_button->IsMenuShowing()) | 96 if (app_menu_button->IsMenuShowing()) |
97 app_menu_button->CloseMenu(); | 97 app_menu_button->CloseMenu(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 focus_manager->UnregisterAccelerator(*action_keybinding_, this); | 162 focus_manager->UnregisterAccelerator(*action_keybinding_, this); |
163 action_keybinding_.reset(); | 163 action_keybinding_.reset(); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 ToolbarActionViewDelegateViews* | 167 ToolbarActionViewDelegateViews* |
168 ExtensionActionPlatformDelegateViews::GetDelegateViews() const { | 168 ExtensionActionPlatformDelegateViews::GetDelegateViews() const { |
169 return static_cast<ToolbarActionViewDelegateViews*>( | 169 return static_cast<ToolbarActionViewDelegateViews*>( |
170 controller_->view_delegate()); | 170 controller_->view_delegate()); |
171 } | 171 } |
OLD | NEW |