OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/native_web_keyboard_event.h" | 34 #include "chrome/common/native_web_keyboard_event.h" |
35 #include "chrome/common/edit_command.h" | 35 #include "chrome/common/edit_command.h" |
36 #include "chrome/common/gpu_messages.h" | 36 #include "chrome/common/gpu_messages.h" |
37 #include "chrome/common/plugin_messages.h" | 37 #include "chrome/common/plugin_messages.h" |
38 #include "chrome/common/render_messages.h" | 38 #include "chrome/common/render_messages.h" |
39 #include "skia/ext/platform_canvas.h" | 39 #include "skia/ext/platform_canvas.h" |
40 #include "third_party/skia/include/core/SkColor.h" | 40 #include "third_party/skia/include/core/SkColor.h" |
41 #include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h" | 41 #include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h" |
42 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 43 #include "webkit/glue/plugins/webplugin.h" |
43 #include "webkit/glue/webaccessibility.h" | 44 #include "webkit/glue/webaccessibility.h" |
44 #include "webkit/plugins/npapi/webplugin.h" | |
45 #import "third_party/mozilla/ComplexTextInputPanel.h" | 45 #import "third_party/mozilla/ComplexTextInputPanel.h" |
46 | 46 |
47 using WebKit::WebInputEvent; | 47 using WebKit::WebInputEvent; |
48 using WebKit::WebInputEventFactory; | 48 using WebKit::WebInputEventFactory; |
49 using WebKit::WebMouseEvent; | 49 using WebKit::WebMouseEvent; |
50 using WebKit::WebMouseWheelEvent; | 50 using WebKit::WebMouseWheelEvent; |
51 | 51 |
52 static inline int ToWebKitModifiers(NSUInteger flags) { | 52 static inline int ToWebKitModifiers(NSUInteger flags) { |
53 int modifiers = 0; | 53 int modifiers = 0; |
54 if (flags & NSControlKeyMask) modifiers |= WebInputEvent::ControlKey; | 54 if (flags & NSControlKeyMask) modifiers |= WebInputEvent::ControlKey; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 rect.set_height(size.height()); | 616 rect.set_height(size.height()); |
617 [cocoa_view_ setFrame: | 617 [cocoa_view_ setFrame: |
618 [(BaseView*)[cocoa_view_ superview] flipRectToNSRect:rect]]; | 618 [(BaseView*)[cocoa_view_ superview] flipRectToNSRect:rect]]; |
619 } | 619 } |
620 | 620 |
621 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() { | 621 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() { |
622 return native_view(); | 622 return native_view(); |
623 } | 623 } |
624 | 624 |
625 void RenderWidgetHostViewMac::MovePluginWindows( | 625 void RenderWidgetHostViewMac::MovePluginWindows( |
626 const std::vector<webkit::npapi::WebPluginGeometry>& moves) { | 626 const std::vector<webkit_glue::WebPluginGeometry>& moves) { |
627 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 627 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
628 // Handle movement of accelerated plugins, which are the only "windowed" | 628 // Handle movement of accelerated plugins, which are the only "windowed" |
629 // plugins that exist on the Mac. | 629 // plugins that exist on the Mac. |
630 for (std::vector<webkit::npapi::WebPluginGeometry>::const_iterator iter = | 630 for (std::vector<webkit_glue::WebPluginGeometry>::const_iterator iter = |
631 moves.begin(); | 631 moves.begin(); |
632 iter != moves.end(); | 632 iter != moves.end(); |
633 ++iter) { | 633 ++iter) { |
634 webkit::npapi::WebPluginGeometry geom = *iter; | 634 webkit_glue::WebPluginGeometry geom = *iter; |
635 | 635 |
636 AcceleratedPluginView* view = ViewForPluginWindowHandle(geom.window); | 636 AcceleratedPluginView* view = ViewForPluginWindowHandle(geom.window); |
637 DCHECK(view); | 637 DCHECK(view); |
638 if (!view) | 638 if (!view) |
639 continue; | 639 continue; |
640 | 640 |
641 if (geom.rects_valid) { | 641 if (geom.rects_valid) { |
642 gfx::Rect rect = geom.window_rect; | 642 gfx::Rect rect = geom.window_rect; |
643 if (geom.visible) { | 643 if (geom.visible) { |
644 rect.set_x(rect.x() + geom.clip_rect.x()); | 644 rect.set_x(rect.x() + geom.clip_rect.x()); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 971 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
972 plugin_container_manager_.SetSizeAndIOSurface(window, | 972 plugin_container_manager_.SetSizeAndIOSurface(window, |
973 width, | 973 width, |
974 height, | 974 height, |
975 io_surface_identifier); | 975 io_surface_identifier); |
976 | 976 |
977 if (plugin_container_manager_.IsRootContainer(window)) { | 977 if (plugin_container_manager_.IsRootContainer(window)) { |
978 // Fake up a WebPluginGeometry for the root window to set the | 978 // Fake up a WebPluginGeometry for the root window to set the |
979 // container's size; we will never get a notification from the | 979 // container's size; we will never get a notification from the |
980 // browser about the root window, only plugins. | 980 // browser about the root window, only plugins. |
981 webkit::npapi::WebPluginGeometry geom; | 981 webkit_glue::WebPluginGeometry geom; |
982 gfx::Rect rect(0, 0, width, height); | 982 gfx::Rect rect(0, 0, width, height); |
983 geom.window = window; | 983 geom.window = window; |
984 geom.window_rect = rect; | 984 geom.window_rect = rect; |
985 geom.clip_rect = rect; | 985 geom.clip_rect = rect; |
986 geom.visible = true; | 986 geom.visible = true; |
987 geom.rects_valid = true; | 987 geom.rects_valid = true; |
988 MovePluginWindows(std::vector<webkit::npapi::WebPluginGeometry>(1, geom)); | 988 MovePluginWindows(std::vector<webkit_glue::WebPluginGeometry>(1, geom)); |
989 } | 989 } |
990 } | 990 } |
991 | 991 |
992 void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB( | 992 void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB( |
993 gfx::PluginWindowHandle window, | 993 gfx::PluginWindowHandle window, |
994 int32 width, | 994 int32 width, |
995 int32 height, | 995 int32 height, |
996 TransportDIB::Handle transport_dib) { | 996 TransportDIB::Handle transport_dib) { |
997 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 997 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
998 plugin_container_manager_.SetSizeAndTransportDIB(window, | 998 plugin_container_manager_.SetSizeAndTransportDIB(window, |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 if (!string) return NO; | 2679 if (!string) return NO; |
2680 | 2680 |
2681 // If the user is currently using an IME, confirm the IME input, | 2681 // If the user is currently using an IME, confirm the IME input, |
2682 // and then insert the text from the service, the same as TextEdit and Safari. | 2682 // and then insert the text from the service, the same as TextEdit and Safari. |
2683 [self confirmComposition]; | 2683 [self confirmComposition]; |
2684 [self insertText:string]; | 2684 [self insertText:string]; |
2685 return YES; | 2685 return YES; |
2686 } | 2686 } |
2687 | 2687 |
2688 @end | 2688 @end |
OLD | NEW |