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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1528153004: Look Up on Force Touch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 (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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 22 matching lines...) Expand all
33 #import "content/browser/accessibility/browser_accessibility_cocoa.h" 33 #import "content/browser/accessibility/browser_accessibility_cocoa.h"
34 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" 34 #include "content/browser/accessibility/browser_accessibility_manager_mac.h"
35 #include "content/browser/bad_message.h" 35 #include "content/browser/bad_message.h"
36 #import "content/browser/cocoa/system_hotkey_helper_mac.h" 36 #import "content/browser/cocoa/system_hotkey_helper_mac.h"
37 #import "content/browser/cocoa/system_hotkey_map.h" 37 #import "content/browser/cocoa/system_hotkey_map.h"
38 #include "content/browser/compositor/resize_lock.h" 38 #include "content/browser/compositor/resize_lock.h"
39 #include "content/browser/frame_host/frame_tree.h" 39 #include "content/browser/frame_host/frame_tree.h"
40 #include "content/browser/frame_host/frame_tree_node.h" 40 #include "content/browser/frame_host/frame_tree_node.h"
41 #include "content/browser/frame_host/render_frame_host_impl.h" 41 #include "content/browser/frame_host/render_frame_host_impl.h"
42 #include "content/browser/gpu/compositor_util.h" 42 #include "content/browser/gpu/compositor_util.h"
43 #include "content/browser/renderer_host/input/input_router.h"
43 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" 44 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h"
44 #include "content/browser/renderer_host/render_view_host_impl.h" 45 #include "content/browser/renderer_host/render_view_host_impl.h"
45 #include "content/browser/renderer_host/render_widget_helper.h" 46 #include "content/browser/renderer_host/render_widget_helper.h"
46 #include "content/browser/renderer_host/render_widget_host_delegate.h" 47 #include "content/browser/renderer_host/render_widget_host_delegate.h"
47 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" 48 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
48 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" 49 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h"
49 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h" 50 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h"
50 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" 51 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h"
51 #include "content/browser/renderer_host/render_widget_resize_helper_mac.h" 52 #include "content/browser/renderer_host/render_widget_resize_helper_mac.h"
52 #import "content/browser/renderer_host/text_input_client_mac.h" 53 #import "content/browser/renderer_host/text_input_client_mac.h"
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 event.skip_in_browser = true; 2322 event.skip_in_browser = true;
2322 widgetHost->ForwardKeyboardEvent(event); 2323 widgetHost->ForwardKeyboardEvent(event);
2323 } 2324 }
2324 } 2325 }
2325 2326
2326 // Possibly autohide the cursor. 2327 // Possibly autohide the cursor.
2327 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) 2328 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent])
2328 [NSCursor setHiddenUntilMouseMoves:YES]; 2329 [NSCursor setHiddenUntilMouseMoves:YES];
2329 } 2330 }
2330 2331
2332 - (void)forceTouchEvent:(NSEvent*)theEvent {
2333 // Convert the event point into coordinates in the a web content.
2334 NSPoint locationInView =
2335 [self convertPoint:[theEvent locationInWindow] fromView:nil];
2336 NSPoint webContentPoint = NSMakePoint(
2337 locationInView.x, [self frame].size.height - locationInView.y);
2338
2339 // Sends an input to the renderer to select the word at the event's
2340 // coordinates. A response from the renderer for this event will cause the
2341 // browser to look up the selected word.
2342 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
2343 rwh->input_router()->SendInput(
2344 scoped_ptr<IPC::Message>(new InputMsg_SelectWordIfAnyAtCoordinates(
2345 rwh->GetRoutingID(), webContentPoint.x, webContentPoint.y)));
2346 }
2347
2331 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event { 2348 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event {
2332 DCHECK(base::mac::IsOSLionOrLater()); 2349 DCHECK(base::mac::IsOSLionOrLater());
2333 2350
2334 if ([event phase] != NSEventPhaseEnded && 2351 if ([event phase] != NSEventPhaseEnded &&
2335 [event phase] != NSEventPhaseCancelled) { 2352 [event phase] != NSEventPhaseCancelled) {
2336 return; 2353 return;
2337 } 2354 }
2338 2355
2339 if (renderWidgetHostView_->render_widget_host_) { 2356 if (renderWidgetHostView_->render_widget_host_) {
2340 // History-swiping is not possible if the logic reaches this point. 2357 // History-swiping is not possible if the logic reaches this point.
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3454 3471
3455 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3472 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3456 // regions that are not draggable. (See ControlRegionView in 3473 // regions that are not draggable. (See ControlRegionView in
3457 // native_app_window_cocoa.mm). This requires the render host view to be 3474 // native_app_window_cocoa.mm). This requires the render host view to be
3458 // draggable by default. 3475 // draggable by default.
3459 - (BOOL)mouseDownCanMoveWindow { 3476 - (BOOL)mouseDownCanMoveWindow {
3460 return YES; 3477 return YES;
3461 } 3478 }
3462 3479
3463 @end 3480 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698