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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 130773004: Start moving context menu code to RenderFrame. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #import "content/browser/web_contents/web_contents_view_mac.h" 7 #import "content/browser/web_contents/web_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // This is called when the renderer asks us to take focus back (i.e., it has 223 // This is called when the renderer asks us to take focus back (i.e., it has
224 // iterated past the last focusable element on the page). 224 // iterated past the last focusable element on the page).
225 void WebContentsViewMac::TakeFocus(bool reverse) { 225 void WebContentsViewMac::TakeFocus(bool reverse) {
226 if (reverse) { 226 if (reverse) {
227 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; 227 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()];
228 } else { 228 } else {
229 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; 229 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()];
230 } 230 }
231 } 231 }
232 232
233 void WebContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { 233 void WebContentsViewMac::ShowContextMenu(
234 content::RenderFrameHost* render_frame_host,
235 const ContextMenuParams& params) {
234 // Allow delegates to handle the context menu operation first. 236 // Allow delegates to handle the context menu operation first.
235 if (web_contents_->GetDelegate() && 237 if (web_contents_->GetDelegate() &&
236 web_contents_->GetDelegate()->HandleContextMenu(params)) { 238 web_contents_->GetDelegate()->HandleContextMenu(params)) {
237 return; 239 return;
238 } 240 }
239 241
240 if (delegate()) 242 if (delegate())
241 delegate()->ShowContextMenu(params); 243 delegate()->ShowContextMenu(render_frame_host, params);
242 else 244 else
243 DLOG(ERROR) << "Cannot show context menus without a delegate."; 245 DLOG(ERROR) << "Cannot show context menus without a delegate.";
244 } 246 }
245 247
246 // Display a popup menu for WebKit using Cocoa widgets. 248 // Display a popup menu for WebKit using Cocoa widgets.
247 void WebContentsViewMac::ShowPopupMenu( 249 void WebContentsViewMac::ShowPopupMenu(
248 const gfx::Rect& bounds, 250 const gfx::Rect& bounds,
249 int item_height, 251 int item_height,
250 double item_font_size, 252 double item_font_size,
251 int selected_item, 253 int selected_item,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 [[[notification userInfo] objectForKey:kSelectionDirection] 622 [[[notification userInfo] objectForKey:kSelectionDirection]
621 unsignedIntegerValue]; 623 unsignedIntegerValue];
622 if (direction == NSDirectSelection) 624 if (direction == NSDirectSelection)
623 return; 625 return;
624 626
625 [self webContents]-> 627 [self webContents]->
626 FocusThroughTabTraversal(direction == NSSelectingPrevious); 628 FocusThroughTabTraversal(direction == NSSelectingPrevious);
627 } 629 }
628 630
629 @end 631 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698