| 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 <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
| 9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
| 10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 using content::BrowserAccessibility; | 91 using content::BrowserAccessibility; |
| 92 using content::BrowserAccessibilityManager; | 92 using content::BrowserAccessibilityManager; |
| 93 using content::EditCommand; | 93 using content::EditCommand; |
| 94 using content::FrameTreeNode; | 94 using content::FrameTreeNode; |
| 95 using content::NativeWebKeyboardEvent; | 95 using content::NativeWebKeyboardEvent; |
| 96 using content::RenderFrameHost; | 96 using content::RenderFrameHost; |
| 97 using content::RenderViewHost; | 97 using content::RenderViewHost; |
| 98 using content::RenderViewHostImpl; | 98 using content::RenderViewHostImpl; |
| 99 using content::RenderWidgetHostImpl; | 99 using content::RenderWidgetHostImpl; |
| 100 using content::RenderWidgetHostView; |
| 100 using content::RenderWidgetHostViewMac; | 101 using content::RenderWidgetHostViewMac; |
| 101 using content::RenderWidgetHostViewMacEditCommandHelper; | 102 using content::RenderWidgetHostViewMacEditCommandHelper; |
| 102 using content::TextInputClientMac; | 103 using content::TextInputClientMac; |
| 103 using content::WebContents; | 104 using content::WebContents; |
| 104 using content::WebGestureEventBuilder; | 105 using content::WebGestureEventBuilder; |
| 105 using content::WebMouseEventBuilder; | 106 using content::WebMouseEventBuilder; |
| 106 using content::WebMouseWheelEventBuilder; | 107 using content::WebMouseWheelEventBuilder; |
| 107 using blink::WebInputEvent; | 108 using blink::WebInputEvent; |
| 108 using blink::WebMouseEvent; | 109 using blink::WebMouseEvent; |
| 109 using blink::WebMouseWheelEvent; | 110 using blink::WebMouseWheelEvent; |
| 110 using blink::WebGestureEvent; | 111 using blink::WebGestureEvent; |
| 111 | 112 |
| 112 namespace { | 113 namespace { |
| 113 | 114 |
| 114 // Whether a keyboard event has been reserved by OSX. | 115 // Whether a keyboard event has been reserved by OSX. |
| 115 BOOL EventIsReservedBySystem(NSEvent* event) { | 116 BOOL EventIsReservedBySystem(NSEvent* event) { |
| 116 content::SystemHotkeyHelperMac* helper = | 117 content::SystemHotkeyHelperMac* helper = |
| 117 content::SystemHotkeyHelperMac::GetInstance(); | 118 content::SystemHotkeyHelperMac::GetInstance(); |
| 118 return helper->map()->IsEventReserved(event); | 119 return helper->map()->IsEventReserved(event); |
| 119 } | 120 } |
| 120 | 121 |
| 121 RenderWidgetHostViewMac* GetRenderWidgetHostViewToUse( | 122 RenderWidgetHostView* GetRenderWidgetHostViewToUse( |
| 122 RenderWidgetHostViewMac* render_widget_host_view) { | 123 RenderWidgetHostViewMac* render_widget_host_view) { |
| 123 WebContents* web_contents = render_widget_host_view->GetWebContents(); | 124 WebContents* web_contents = render_widget_host_view->GetWebContents(); |
| 124 if (!web_contents) | 125 if (!web_contents) |
| 125 return render_widget_host_view; | 126 return render_widget_host_view; |
| 126 content::BrowserPluginGuestManager* guest_manager = | 127 content::BrowserPluginGuestManager* guest_manager = |
| 127 web_contents->GetBrowserContext()->GetGuestManager(); | 128 web_contents->GetBrowserContext()->GetGuestManager(); |
| 128 if (!guest_manager) | 129 if (!guest_manager) |
| 129 return render_widget_host_view; | 130 return render_widget_host_view; |
| 130 content::WebContents* guest = | 131 content::WebContents* guest = |
| 131 guest_manager->GetFullPageGuest(web_contents); | 132 guest_manager->GetFullPageGuest(web_contents); |
| 132 if (!guest) | 133 if (!guest) |
| 133 return render_widget_host_view; | 134 return render_widget_host_view; |
| 134 return static_cast<RenderWidgetHostViewMac*>( | 135 return guest->GetRenderWidgetHostView(); |
| 135 guest->GetRenderWidgetHostView()); | |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 // These are not documented, so use only after checking -respondsToSelector:. | 140 // These are not documented, so use only after checking -respondsToSelector:. |
| 141 @interface NSApplication (UndocumentedSpeechMethods) | 141 @interface NSApplication (UndocumentedSpeechMethods) |
| 142 - (void)speakString:(NSString*)string; | 142 - (void)speakString:(NSString*)string; |
| 143 - (void)stopSpeaking:(id)sender; | 143 - (void)stopSpeaking:(id)sender; |
| 144 - (BOOL)isSpeaking; | 144 - (BOOL)isSpeaking; |
| 145 @end | 145 @end |
| (...skipping 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3420 | 3420 |
| 3421 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3421 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3422 // regions that are not draggable. (See ControlRegionView in | 3422 // regions that are not draggable. (See ControlRegionView in |
| 3423 // native_app_window_cocoa.mm). This requires the render host view to be | 3423 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3424 // draggable by default. | 3424 // draggable by default. |
| 3425 - (BOOL)mouseDownCanMoveWindow { | 3425 - (BOOL)mouseDownCanMoveWindow { |
| 3426 return YES; | 3426 return YES; |
| 3427 } | 3427 } |
| 3428 | 3428 |
| 3429 @end | 3429 @end |
| OLD | NEW |