| 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" | 
|    55 #include "content/common/input_messages.h" |    56 #include "content/common/input_messages.h" | 
|    56 #include "content/common/site_isolation_policy.h" |    57 #include "content/common/site_isolation_policy.h" | 
|    57 #include "content/common/text_input_state.h" |    58 #include "content/common/text_input_state.h" | 
|    58 #include "content/common/view_messages.h" |    59 #include "content/common/view_messages.h" | 
|    59 #include "content/public/browser/browser_context.h" |    60 #include "content/public/browser/browser_context.h" | 
|    60 #include "content/public/browser/browser_plugin_guest_manager.h" |    61 #include "content/public/browser/browser_plugin_guest_manager.h" | 
|    61 #include "content/public/browser/browser_thread.h" |    62 #include "content/public/browser/browser_thread.h" | 
|    62 #include "content/public/browser/native_web_keyboard_event.h" |    63 #include "content/public/browser/native_web_keyboard_event.h" | 
|    63 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |    64 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 
|    64 #import "content/public/browser/render_widget_host_view_mac_delegate.h" |    65 #import "content/public/browser/render_widget_host_view_mac_delegate.h" | 
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   555                                                  bool is_guest_view_hack) |   556                                                  bool is_guest_view_hack) | 
|   556     : render_widget_host_(RenderWidgetHostImpl::From(widget)), |   557     : render_widget_host_(RenderWidgetHostImpl::From(widget)), | 
|   557       text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |   558       text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 
|   558       can_compose_inline_(true), |   559       can_compose_inline_(true), | 
|   559       browser_compositor_state_(BrowserCompositorDestroyed), |   560       browser_compositor_state_(BrowserCompositorDestroyed), | 
|   560       browser_compositor_placeholder_(new BrowserCompositorMacPlaceholder), |   561       browser_compositor_placeholder_(new BrowserCompositorMacPlaceholder), | 
|   561       page_at_minimum_scale_(true), |   562       page_at_minimum_scale_(true), | 
|   562       is_loading_(false), |   563       is_loading_(false), | 
|   563       allow_pause_for_resize_or_repaint_(true), |   564       allow_pause_for_resize_or_repaint_(true), | 
|   564       is_guest_view_hack_(is_guest_view_hack), |   565       is_guest_view_hack_(is_guest_view_hack), | 
 |   566       wheel_gestures_enabled_(UseGestureBasedWheelScrolling()), | 
|   565       fullscreen_parent_host_view_(nullptr), |   567       fullscreen_parent_host_view_(nullptr), | 
|   566       begin_frame_source_(nullptr), |   568       begin_frame_source_(nullptr), | 
|   567       needs_begin_frames_(false), |   569       needs_begin_frames_(false), | 
|   568       weak_factory_(this) { |   570       weak_factory_(this) { | 
|   569   // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| |   571   // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| | 
|   570   // goes away.  Since we autorelease it, our caller must put |   572   // goes away.  Since we autorelease it, our caller must put | 
|   571   // |GetNativeView()| into the view hierarchy right after calling us. |   573   // |GetNativeView()| into the view hierarchy right after calling us. | 
|   572   cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] |   574   cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] | 
|   573                   initWithRenderWidgetHostViewMac:this] autorelease]; |   575                   initWithRenderWidgetHostViewMac:this] autorelease]; | 
|   574  |   576  | 
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1568   mouse_locked_ = false; |  1570   mouse_locked_ = false; | 
|  1569  |  1571  | 
|  1570   // Unlock position of mouse cursor and unhide it. |  1572   // Unlock position of mouse cursor and unhide it. | 
|  1571   CGAssociateMouseAndMouseCursorPosition(YES); |  1573   CGAssociateMouseAndMouseCursorPosition(YES); | 
|  1572   [NSCursor unhide]; |  1574   [NSCursor unhide]; | 
|  1573  |  1575  | 
|  1574   if (render_widget_host_) |  1576   if (render_widget_host_) | 
|  1575     render_widget_host_->LostMouseLock(); |  1577     render_widget_host_->LostMouseLock(); | 
|  1576 } |  1578 } | 
|  1577  |  1579  | 
 |  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  | 
|  1578 void RenderWidgetHostViewMac::GestureEventAck( |  1594 void RenderWidgetHostViewMac::GestureEventAck( | 
|  1579     const blink::WebGestureEvent& event, |  1595     const blink::WebGestureEvent& event, | 
|  1580     InputEventAckState ack_result) { |  1596     InputEventAckState ack_result) { | 
|  1581   if (!wheel_gestures_enabled_) |  1597   if (!wheel_gestures_enabled_) | 
|  1582     return; |  1598     return; | 
|  1583   bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |  1599   bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 
|  1584   switch (event.type) { |  1600   switch (event.type) { | 
|  1585     case blink::WebInputEvent::GestureScrollBegin: |  1601     case blink::WebInputEvent::GestureScrollBegin: | 
|  1586     case blink::WebInputEvent::GestureScrollUpdate: |  1602     case blink::WebInputEvent::GestureScrollUpdate: | 
|  1587     case blink::WebInputEvent::GestureScrollEnd: |  1603     case blink::WebInputEvent::GestureScrollEnd: | 
| (...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3444  |  3460  | 
|  3445 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |  3461 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 
|  3446 // regions that are not draggable. (See ControlRegionView in |  3462 // regions that are not draggable. (See ControlRegionView in | 
|  3447 // native_app_window_cocoa.mm). This requires the render host view to be |  3463 // native_app_window_cocoa.mm). This requires the render host view to be | 
|  3448 // draggable by default. |  3464 // draggable by default. | 
|  3449 - (BOOL)mouseDownCanMoveWindow { |  3465 - (BOOL)mouseDownCanMoveWindow { | 
|  3450   return YES; |  3466   return YES; | 
|  3451 } |  3467 } | 
|  3452  |  3468  | 
|  3453 @end |  3469 @end | 
| OLD | NEW |