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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 using content::RenderViewHost; | 81 using content::RenderViewHost; |
82 using content::RenderViewHostImpl; | 82 using content::RenderViewHostImpl; |
83 using content::RenderWidgetHostImpl; | 83 using content::RenderWidgetHostImpl; |
84 using content::RenderWidgetHostViewMac; | 84 using content::RenderWidgetHostViewMac; |
85 using content::RenderWidgetHostViewMacEditCommandHelper; | 85 using content::RenderWidgetHostViewMacEditCommandHelper; |
86 using content::TextInputClientMac; | 86 using content::TextInputClientMac; |
87 using blink::WebInputEvent; | 87 using blink::WebInputEvent; |
88 using blink::WebInputEventFactory; | 88 using blink::WebInputEventFactory; |
89 using blink::WebMouseEvent; | 89 using blink::WebMouseEvent; |
90 using blink::WebMouseWheelEvent; | 90 using blink::WebMouseWheelEvent; |
| 91 using blink::WebGestureEvent; |
91 | 92 |
92 // These are not documented, so use only after checking -respondsToSelector:. | 93 // These are not documented, so use only after checking -respondsToSelector:. |
93 @interface NSApplication (UndocumentedSpeechMethods) | 94 @interface NSApplication (UndocumentedSpeechMethods) |
94 - (void)speakString:(NSString*)string; | 95 - (void)speakString:(NSString*)string; |
95 - (void)stopSpeaking:(id)sender; | 96 - (void)stopSpeaking:(id)sender; |
96 - (BOOL)isSpeaking; | 97 - (BOOL)isSpeaking; |
97 @end | 98 @end |
98 | 99 |
99 // Declare things that are part of the 10.7 SDK. | 100 // Declare things that are part of the 10.7 SDK. |
100 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 101 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 } | 2858 } |
2858 | 2859 |
2859 // This is responsible for content scrolling! | 2860 // This is responsible for content scrolling! |
2860 if (renderWidgetHostView_->render_widget_host_) { | 2861 if (renderWidgetHostView_->render_widget_host_) { |
2861 const WebMouseWheelEvent& webEvent = | 2862 const WebMouseWheelEvent& webEvent = |
2862 WebInputEventFactory::mouseWheelEvent(event, self); | 2863 WebInputEventFactory::mouseWheelEvent(event, self); |
2863 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); | 2864 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(webEvent); |
2864 } | 2865 } |
2865 } | 2866 } |
2866 | 2867 |
| 2868 // Called repeatedly during a pinch gesture, with incremental change values. |
| 2869 - (void)magnifyWithEvent:(NSEvent*)event { |
| 2870 if (renderWidgetHostView_->render_widget_host_) { |
| 2871 // Send a GesturePinchUpdate event. |
| 2872 // Note that we don't attempt to bracket these by GesturePinchBegin/End (or |
| 2873 // GestureSrollBegin/End) as is done for touchscreen. Keeping track of when |
| 2874 // a pinch is active would take a little more work here, and we don't need |
| 2875 // it for anything yet. |
| 2876 const WebGestureEvent& webEvent = |
| 2877 WebInputEventFactory::gestureEvent(event, self); |
| 2878 renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(webEvent); |
| 2879 } |
| 2880 } |
| 2881 |
2867 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { | 2882 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
2868 NSWindow* oldWindow = [self window]; | 2883 NSWindow* oldWindow = [self window]; |
2869 | 2884 |
2870 // We're messing with the window, so do this to ensure no flashes. This one | 2885 // We're messing with the window, so do this to ensure no flashes. This one |
2871 // prevents a flash when the current tab is closed. | 2886 // prevents a flash when the current tab is closed. |
2872 if (!renderWidgetHostView_->use_core_animation_) | 2887 if (!renderWidgetHostView_->use_core_animation_) |
2873 [oldWindow disableScreenUpdatesUntilFlush]; | 2888 [oldWindow disableScreenUpdatesUntilFlush]; |
2874 | 2889 |
2875 NSNotificationCenter* notificationCenter = | 2890 NSNotificationCenter* notificationCenter = |
2876 [NSNotificationCenter defaultCenter]; | 2891 [NSNotificationCenter defaultCenter]; |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4241 CGColorGetConstantColor(kCGColorWhite)); | 4256 CGColorGetConstantColor(kCGColorWhite)); |
4242 CGContextFillRect(context, clipRect); | 4257 CGContextFillRect(context, clipRect); |
4243 } | 4258 } |
4244 } | 4259 } |
4245 | 4260 |
4246 - (void)disableRendering { | 4261 - (void)disableRendering { |
4247 renderWidgetHostView_ = NULL; | 4262 renderWidgetHostView_ = NULL; |
4248 } | 4263 } |
4249 | 4264 |
4250 @end // implementation SoftwareLayer | 4265 @end // implementation SoftwareLayer |
OLD | NEW |