OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/browser/renderer_host/render_view_host_impl.h" | 45 #include "content/browser/renderer_host/render_view_host_impl.h" |
46 #include "content/browser/renderer_host/render_widget_helper.h" | 46 #include "content/browser/renderer_host/render_widget_helper.h" |
47 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 47 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
48 #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" |
49 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he
lper.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_editcommand_h
elper.h" | 50 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" |
51 #include "content/browser/renderer_host/resize_lock.h" | 51 #include "content/browser/renderer_host/resize_lock.h" |
52 #import "content/browser/renderer_host/text_input_client_mac.h" | 52 #import "content/browser/renderer_host/text_input_client_mac.h" |
53 #include "content/common/accessibility_messages.h" | 53 #include "content/common/accessibility_messages.h" |
54 #include "content/common/edit_command.h" | 54 #include "content/common/edit_command.h" |
55 #include "content/common/input/input_event_utils.h" | |
56 #include "content/common/input_messages.h" | 55 #include "content/common/input_messages.h" |
57 #include "content/common/site_isolation_policy.h" | 56 #include "content/common/site_isolation_policy.h" |
58 #include "content/common/text_input_state.h" | 57 #include "content/common/text_input_state.h" |
59 #include "content/common/view_messages.h" | 58 #include "content/common/view_messages.h" |
60 #include "content/public/browser/browser_context.h" | 59 #include "content/public/browser/browser_context.h" |
61 #include "content/public/browser/browser_plugin_guest_manager.h" | 60 #include "content/public/browser/browser_plugin_guest_manager.h" |
62 #include "content/public/browser/browser_thread.h" | 61 #include "content/public/browser/browser_thread.h" |
63 #include "content/public/browser/native_web_keyboard_event.h" | 62 #include "content/public/browser/native_web_keyboard_event.h" |
64 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 63 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
65 #import "content/public/browser/render_widget_host_view_mac_delegate.h" | 64 #import "content/public/browser/render_widget_host_view_mac_delegate.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 bool is_guest_view_hack) | 555 bool is_guest_view_hack) |
557 : render_widget_host_(RenderWidgetHostImpl::From(widget)), | 556 : render_widget_host_(RenderWidgetHostImpl::From(widget)), |
558 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 557 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
559 can_compose_inline_(true), | 558 can_compose_inline_(true), |
560 browser_compositor_state_(BrowserCompositorDestroyed), | 559 browser_compositor_state_(BrowserCompositorDestroyed), |
561 browser_compositor_placeholder_(new BrowserCompositorMacPlaceholder), | 560 browser_compositor_placeholder_(new BrowserCompositorMacPlaceholder), |
562 page_at_minimum_scale_(true), | 561 page_at_minimum_scale_(true), |
563 is_loading_(false), | 562 is_loading_(false), |
564 allow_pause_for_resize_or_repaint_(true), | 563 allow_pause_for_resize_or_repaint_(true), |
565 is_guest_view_hack_(is_guest_view_hack), | 564 is_guest_view_hack_(is_guest_view_hack), |
566 wheel_gestures_enabled_(UseGestureBasedWheelScrolling()), | |
567 fullscreen_parent_host_view_(nullptr), | 565 fullscreen_parent_host_view_(nullptr), |
568 begin_frame_source_(nullptr), | 566 begin_frame_source_(nullptr), |
569 needs_begin_frames_(false), | 567 needs_begin_frames_(false), |
570 weak_factory_(this) { | 568 weak_factory_(this) { |
571 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| | 569 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| |
572 // goes away. Since we autorelease it, our caller must put | 570 // goes away. Since we autorelease it, our caller must put |
573 // |GetNativeView()| into the view hierarchy right after calling us. | 571 // |GetNativeView()| into the view hierarchy right after calling us. |
574 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] | 572 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] |
575 initWithRenderWidgetHostViewMac:this] autorelease]; | 573 initWithRenderWidgetHostViewMac:this] autorelease]; |
576 | 574 |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 mouse_locked_ = false; | 1568 mouse_locked_ = false; |
1571 | 1569 |
1572 // Unlock position of mouse cursor and unhide it. | 1570 // Unlock position of mouse cursor and unhide it. |
1573 CGAssociateMouseAndMouseCursorPosition(YES); | 1571 CGAssociateMouseAndMouseCursorPosition(YES); |
1574 [NSCursor unhide]; | 1572 [NSCursor unhide]; |
1575 | 1573 |
1576 if (render_widget_host_) | 1574 if (render_widget_host_) |
1577 render_widget_host_->LostMouseLock(); | 1575 render_widget_host_->LostMouseLock(); |
1578 } | 1576 } |
1579 | 1577 |
1580 void RenderWidgetHostViewMac::WheelEventAck( | |
1581 const blink::WebMouseWheelEvent& event, | |
1582 InputEventAckState ack_result) { | |
1583 // TODO(dtapuska): Remove this handling of the wheel event ack | |
1584 // once wheel gestures is enabled for a full release; see crbug.com/598798. | |
1585 if (wheel_gestures_enabled_) | |
1586 return; | |
1587 bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | |
1588 // Only record a wheel event as unhandled if JavaScript handlers got a chance | |
1589 // to see it (no-op wheel events are ignored by the event dispatcher) | |
1590 if (event.deltaX || event.deltaY) | |
1591 [cocoa_view_ processedWheelEvent:event consumed:consumed]; | |
1592 } | |
1593 | |
1594 void RenderWidgetHostViewMac::GestureEventAck( | 1578 void RenderWidgetHostViewMac::GestureEventAck( |
1595 const blink::WebGestureEvent& event, | 1579 const blink::WebGestureEvent& event, |
1596 InputEventAckState ack_result) { | 1580 InputEventAckState ack_result) { |
1597 if (!wheel_gestures_enabled_) | |
1598 return; | |
1599 bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 1581 bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
1600 switch (event.type) { | 1582 switch (event.type) { |
1601 case blink::WebInputEvent::GestureScrollBegin: | 1583 case blink::WebInputEvent::GestureScrollBegin: |
1602 case blink::WebInputEvent::GestureScrollUpdate: | 1584 case blink::WebInputEvent::GestureScrollUpdate: |
1603 case blink::WebInputEvent::GestureScrollEnd: | 1585 case blink::WebInputEvent::GestureScrollEnd: |
1604 [cocoa_view_ processedGestureScrollEvent:event consumed:consumed]; | 1586 [cocoa_view_ processedGestureScrollEvent:event consumed:consumed]; |
1605 return; | 1587 return; |
1606 default: | 1588 default: |
1607 break; | 1589 break; |
1608 } | 1590 } |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3460 | 3442 |
3461 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3443 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3462 // regions that are not draggable. (See ControlRegionView in | 3444 // regions that are not draggable. (See ControlRegionView in |
3463 // native_app_window_cocoa.mm). This requires the render host view to be | 3445 // native_app_window_cocoa.mm). This requires the render host view to be |
3464 // draggable by default. | 3446 // draggable by default. |
3465 - (BOOL)mouseDownCanMoveWindow { | 3447 - (BOOL)mouseDownCanMoveWindow { |
3466 return YES; | 3448 return YES; |
3467 } | 3449 } |
3468 | 3450 |
3469 @end | 3451 @end |
OLD | NEW |