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

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

Issue 10917102: Context menus should appear above the touch point if invoked by long press. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 3 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // iterated past the last focusable element on the page). 274 // iterated past the last focusable element on the page).
275 void WebContentsViewMac::TakeFocus(bool reverse) { 275 void WebContentsViewMac::TakeFocus(bool reverse) {
276 if (reverse) { 276 if (reverse) {
277 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; 277 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()];
278 } else { 278 } else {
279 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; 279 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()];
280 } 280 }
281 } 281 }
282 282
283 void WebContentsViewMac::ShowContextMenu( 283 void WebContentsViewMac::ShowContextMenu(
284 const content::ContextMenuParams& params) { 284 const content::ContextMenuParams& params,
285 const content::ContextMenuSourceType& type) {
285 // Allow delegates to handle the context menu operation first. 286 // Allow delegates to handle the context menu operation first.
286 if (web_contents_->GetDelegate() && 287 if (web_contents_->GetDelegate() &&
287 web_contents_->GetDelegate()->HandleContextMenu(params)) { 288 web_contents_->GetDelegate()->HandleContextMenu(params)) {
288 return; 289 return;
289 } 290 }
290 291
291 if (delegate()) 292 if (delegate())
292 delegate()->ShowContextMenu(params); 293 delegate()->ShowContextMenu(params, type);
293 else 294 else
294 DLOG(ERROR) << "Cannot show context menus without a delegate."; 295 DLOG(ERROR) << "Cannot show context menus without a delegate.";
295 } 296 }
296 297
297 // Display a popup menu for WebKit using Cocoa widgets. 298 // Display a popup menu for WebKit using Cocoa widgets.
298 void WebContentsViewMac::ShowPopupMenu( 299 void WebContentsViewMac::ShowPopupMenu(
299 const gfx::Rect& bounds, 300 const gfx::Rect& bounds,
300 int item_height, 301 int item_height,
301 double item_font_size, 302 double item_font_size,
302 int selected_item, 303 int selected_item,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 [[[notification userInfo] objectForKey:kSelectionDirection] 530 [[[notification userInfo] objectForKey:kSelectionDirection]
530 unsignedIntegerValue]; 531 unsignedIntegerValue];
531 if (direction == NSDirectSelection) 532 if (direction == NSDirectSelection)
532 return; 533 return;
533 534
534 [self webContents]-> 535 [self webContents]->
535 FocusThroughTabTraversal(direction == NSSelectingPrevious); 536 FocusThroughTabTraversal(direction == NSSelectingPrevious);
536 } 537 }
537 538
538 @end 539 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698