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

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 4 years, 11 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 (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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 using content::RenderWidgetHostViewMacEditCommandHelper; 100 using content::RenderWidgetHostViewMacEditCommandHelper;
100 using content::TextInputClientMac; 101 using content::TextInputClientMac;
101 using content::WebContents; 102 using content::WebContents;
102 using content::WebGestureEventBuilder; 103 using content::WebGestureEventBuilder;
103 using content::WebMouseEventBuilder; 104 using content::WebMouseEventBuilder;
104 using content::WebMouseWheelEventBuilder; 105 using content::WebMouseWheelEventBuilder;
105 using blink::WebInputEvent; 106 using blink::WebInputEvent;
106 using blink::WebMouseEvent; 107 using blink::WebMouseEvent;
107 using blink::WebMouseWheelEvent; 108 using blink::WebMouseWheelEvent;
108 using blink::WebGestureEvent; 109 using blink::WebGestureEvent;
110 using blink::WebPoint;
109 111
110 namespace { 112 namespace {
111 113
112 // Whether a keyboard event has been reserved by OSX. 114 // Whether a keyboard event has been reserved by OSX.
113 BOOL EventIsReservedBySystem(NSEvent* event) { 115 BOOL EventIsReservedBySystem(NSEvent* event) {
114 content::SystemHotkeyHelperMac* helper = 116 content::SystemHotkeyHelperMac* helper =
115 content::SystemHotkeyHelperMac::GetInstance(); 117 content::SystemHotkeyHelperMac::GetInstance();
116 return helper->map()->IsEventReserved(event); 118 return helper->map()->IsEventReserved(event);
117 } 119 }
118 120
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 event.skip_in_browser = true; 2303 event.skip_in_browser = true;
2302 widgetHost->ForwardKeyboardEvent(event); 2304 widgetHost->ForwardKeyboardEvent(event);
2303 } 2305 }
2304 } 2306 }
2305 2307
2306 // Possibly autohide the cursor. 2308 // Possibly autohide the cursor.
2307 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent]) 2309 if ([RenderWidgetHostViewCocoa shouldAutohideCursorForEvent:theEvent])
2308 [NSCursor setHiddenUntilMouseMoves:YES]; 2310 [NSCursor setHiddenUntilMouseMoves:YES];
2309 } 2311 }
2310 2312
2313 - (void)forceTouchEvent:(NSEvent*)theEvent {
2314 // Convert the event point into coordinates in the a web content.
2315 NSPoint locationInView =
2316 [self convertPoint:[theEvent locationInWindow] fromView:nil];
2317 WebPoint point(locationInView.x,
2318 [self frame].size.height - locationInView.y);
2319
2320 // Sends an input to the renderer to select the word at the event's
2321 // coordinates. A response from the renderer for this event will cause the
2322 // browser to look up the selected word.
2323 RenderWidgetHostImpl* rwh = renderWidgetHostView_->render_widget_host_;
2324 rwh->input_router()->SendInput(
2325 scoped_ptr<IPC::Message>(new InputMsg_SelectWordIfAnyAt(
2326 rwh->GetRoutingID(), point)));
2327 }
2328
2311 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event { 2329 - (void)shortCircuitScrollWheelEvent:(NSEvent*)event {
2312 DCHECK(base::mac::IsOSLionOrLater()); 2330 DCHECK(base::mac::IsOSLionOrLater());
2313 2331
2314 if ([event phase] != NSEventPhaseEnded && 2332 if ([event phase] != NSEventPhaseEnded &&
2315 [event phase] != NSEventPhaseCancelled) { 2333 [event phase] != NSEventPhaseCancelled) {
2316 return; 2334 return;
2317 } 2335 }
2318 2336
2319 if (renderWidgetHostView_->render_widget_host_) { 2337 if (renderWidgetHostView_->render_widget_host_) {
2320 // History-swiping is not possible if the logic reaches this point. 2338 // History-swiping is not possible if the logic reaches this point.
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3434 3452
3435 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3453 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3436 // regions that are not draggable. (See ControlRegionView in 3454 // regions that are not draggable. (See ControlRegionView in
3437 // native_app_window_cocoa.mm). This requires the render host view to be 3455 // native_app_window_cocoa.mm). This requires the render host view to be
3438 // draggable by default. 3456 // draggable by default.
3439 - (BOOL)mouseDownCanMoveWindow { 3457 - (BOOL)mouseDownCanMoveWindow {
3440 return YES; 3458 return YES;
3441 } 3459 }
3442 3460
3443 @end 3461 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698