Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_action_platform_delegate_cocoa.mm

Issue 1105713002: [Extension Toolbar] Slide out overflowed actions for popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/extensions/extension_action_platform_delegate_c ocoa.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_platform_delegate_c ocoa.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 registrar_.Add( 68 registrar_.Add(
69 this, 69 this,
70 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 70 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
71 content::Source<Profile>(controller_->browser()->profile())); 71 content::Source<Profile>(controller_->browser()->profile()));
72 registrar_.Add( 72 registrar_.Add(
73 this, 73 this,
74 GetNotificationTypeForAction(*controller_->extension_action()), 74 GetNotificationTypeForAction(*controller_->extension_action()),
75 content::Source<Profile>(controller_->browser()->profile())); 75 content::Source<Profile>(controller_->browser()->profile()));
76 } 76 }
77 77
78 extensions::ExtensionViewHost* 78 void ExtensionActionPlatformDelegateCocoa::ShowPopup(
79 ExtensionActionPlatformDelegateCocoa::ShowPopupWithUrl( 79 scoped_ptr<extensions::ExtensionViewHost> host,
80 ExtensionActionViewController::PopupShowAction show_action, 80 bool grant_tab_permissions,
81 const GURL& popup_url, 81 ExtensionActionViewController::PopupShowAction show_action) {
82 bool grant_tab_permissions) { 82 BOOL devMode =
83 show_action == ExtensionActionViewController::SHOW_POPUP_AND_INSPECT;
84 [ExtensionPopupController host:host.Pass()
85 inBrowser:controller_->browser()
86 anchoredAt:GetPopupPoint()
87 arrowLocation:info_bubble::kTopRight
88 devMode:devMode];
89 }
90
91 void ExtensionActionPlatformDelegateCocoa::CloseOverflowMenu() {
83 // If this was triggered by an action overflowed to the wrench menu, then 92 // If this was triggered by an action overflowed to the wrench menu, then
84 // the wrench menu will be open. Close it before opening the popup. 93 // the wrench menu will be open. Close it before opening the popup.
85 WrenchMenuController* wrenchMenuController = 94 WrenchMenuController* wrenchMenuController =
86 [[[BrowserWindowController 95 [[[BrowserWindowController
87 browserWindowControllerForWindow: 96 browserWindowControllerForWindow:
88 controller_->browser()->window()->GetNativeWindow()] 97 controller_->browser()->window()->GetNativeWindow()]
89 toolbarController] wrenchMenuController]; 98 toolbarController] wrenchMenuController];
90 if ([wrenchMenuController isMenuOpen]) 99 if ([wrenchMenuController isMenuOpen])
91 [wrenchMenuController cancel]; 100 [wrenchMenuController cancel];
92
93 BOOL devMode =
94 show_action == ExtensionActionViewController::SHOW_POPUP_AND_INSPECT;
95 ExtensionPopupController* popupController =
96 [ExtensionPopupController showURL:popup_url
97 inBrowser:controller_->browser()
98 anchoredAt:GetPopupPoint()
99 arrowLocation:info_bubble::kTopRight
100 devMode:devMode];
101 return [popupController extensionViewHost];
102 } 101 }
103 102
104 NSPoint ExtensionActionPlatformDelegateCocoa::GetPopupPoint() const { 103 NSPoint ExtensionActionPlatformDelegateCocoa::GetPopupPoint() const {
105 BrowserWindowController* windowController = 104 BrowserWindowController* windowController =
106 [BrowserWindowController browserWindowControllerForWindow: 105 [BrowserWindowController browserWindowControllerForWindow:
107 controller_->browser()->window()->GetNativeWindow()]; 106 controller_->browser()->window()->GetNativeWindow()];
108 NSPoint popupPoint; 107 NSPoint popupPoint;
109 if (controller_->extension_action()->action_type() == 108 if (controller_->extension_action()->action_type() ==
110 extensions::ActionInfo::TYPE_PAGE) { 109 extensions::ActionInfo::TYPE_PAGE) {
111 popupPoint = [windowController locationBarBridge]->GetPageActionBubblePoint( 110 popupPoint = [windowController locationBarBridge]->GetPageActionBubblePoint(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 controller_->IsEnabled( 148 controller_->IsEnabled(
150 controller_->view_delegate()->GetCurrentWebContents())) { 149 controller_->view_delegate()->GetCurrentWebContents())) {
151 controller_->ExecuteAction(true); 150 controller_->ExecuteAction(true);
152 } 151 }
153 break; 152 break;
154 } 153 }
155 default: 154 default:
156 NOTREACHED() << L"Unexpected notification"; 155 NOTREACHED() << L"Unexpected notification";
157 } 156 }
158 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698