| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ExtensionActionPlatformDelegateViews::ShowContextMenu() { |
| 101 views::View* view = GetDelegateViews()->GetAsView(); |
| 102 view->context_menu_controller()->ShowContextMenuForView( |
| 103 view, view->GetKeyboardContextMenuLocation(), ui::MENU_SOURCE_NONE); |
| 104 } |
| 105 |
| 100 void ExtensionActionPlatformDelegateViews::Observe( | 106 void ExtensionActionPlatformDelegateViews::Observe( |
| 101 int type, | 107 int type, |
| 102 const content::NotificationSource& source, | 108 const content::NotificationSource& source, |
| 103 const content::NotificationDetails& details) { | 109 const content::NotificationDetails& details) { |
| 104 DCHECK(type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED || | 110 DCHECK(type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED || |
| 105 type == extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED); | 111 type == extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED); |
| 106 extensions::ExtensionCommandRemovedDetails* payload = | 112 extensions::ExtensionCommandRemovedDetails* payload = |
| 107 content::Details<extensions::ExtensionCommandRemovedDetails>(details) | 113 content::Details<extensions::ExtensionCommandRemovedDetails>(details) |
| 108 .ptr(); | 114 .ptr(); |
| 109 if (controller_->extension()->id() == payload->extension_id && | 115 if (controller_->extension()->id() == payload->extension_id && |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 focus_manager->UnregisterAccelerator(*action_keybinding_, this); | 168 focus_manager->UnregisterAccelerator(*action_keybinding_, this); |
| 163 action_keybinding_.reset(); | 169 action_keybinding_.reset(); |
| 164 } | 170 } |
| 165 } | 171 } |
| 166 | 172 |
| 167 ToolbarActionViewDelegateViews* | 173 ToolbarActionViewDelegateViews* |
| 168 ExtensionActionPlatformDelegateViews::GetDelegateViews() const { | 174 ExtensionActionPlatformDelegateViews::GetDelegateViews() const { |
| 169 return static_cast<ToolbarActionViewDelegateViews*>( | 175 return static_cast<ToolbarActionViewDelegateViews*>( |
| 170 controller_->view_delegate()); | 176 controller_->view_delegate()); |
| 171 } | 177 } |
| OLD | NEW |