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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "skia/ext/image_operations.h" | 53 #include "skia/ext/image_operations.h" |
54 #include "skia/ext/platform_canvas.h" | 54 #include "skia/ext/platform_canvas.h" |
55 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 55 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
56 #include "ui/base/events/event.h" | 56 #include "ui/base/events/event.h" |
57 #include "ui/base/keycodes/keyboard_codes.h" | 57 #include "ui/base/keycodes/keyboard_codes.h" |
58 #include "ui/gfx/size_conversions.h" | 58 #include "ui/gfx/size_conversions.h" |
59 #include "ui/gfx/skbitmap_operations.h" | 59 #include "ui/gfx/skbitmap_operations.h" |
60 #include "ui/gfx/vector2d_conversions.h" | 60 #include "ui/gfx/vector2d_conversions.h" |
61 #include "webkit/common/cursors/webcursor.h" | 61 #include "webkit/common/cursors/webcursor.h" |
62 #include "webkit/common/webpreferences.h" | 62 #include "webkit/common/webpreferences.h" |
63 #include "webkit/plugins/npapi/plugin_utils.h" | |
64 | 63 |
65 #if defined(TOOLKIT_GTK) | 64 #if defined(TOOLKIT_GTK) |
66 #include "content/browser/renderer_host/backing_store_gtk.h" | 65 #include "content/browser/renderer_host/backing_store_gtk.h" |
67 #elif defined(OS_MACOSX) | 66 #elif defined(OS_MACOSX) |
68 #include "content/browser/renderer_host/backing_store_mac.h" | 67 #include "content/browser/renderer_host/backing_store_mac.h" |
| 68 #elif defined(OS_WIN) |
| 69 #include "content/common/plugin_constants_win.h" |
69 #endif | 70 #endif |
70 | 71 |
71 using base::Time; | 72 using base::Time; |
72 using base::TimeDelta; | 73 using base::TimeDelta; |
73 using base::TimeTicks; | 74 using base::TimeTicks; |
74 using WebKit::WebGestureEvent; | 75 using WebKit::WebGestureEvent; |
75 using WebKit::WebInputEvent; | 76 using WebKit::WebInputEvent; |
76 using WebKit::WebKeyboardEvent; | 77 using WebKit::WebKeyboardEvent; |
77 using WebKit::WebMouseEvent; | 78 using WebKit::WebMouseEvent; |
78 using WebKit::WebMouseWheelEvent; | 79 using WebKit::WebMouseWheelEvent; |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 | 2225 |
2225 zoomed_bitmap.setPixels(0); | 2226 zoomed_bitmap.setPixels(0); |
2226 Send(new ViewMsg_ReleaseDisambiguationPopupDIB(GetRoutingID(), | 2227 Send(new ViewMsg_ReleaseDisambiguationPopupDIB(GetRoutingID(), |
2227 dib->handle())); | 2228 dib->handle())); |
2228 } | 2229 } |
2229 | 2230 |
2230 #if defined(OS_WIN) | 2231 #if defined(OS_WIN) |
2231 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( | 2232 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( |
2232 gfx::NativeViewId dummy_activation_window) { | 2233 gfx::NativeViewId dummy_activation_window) { |
2233 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); | 2234 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
2234 if (!IsWindow(hwnd) || !webkit::npapi::IsDummyActivationWindow(hwnd)) { | 2235 |
2235 // This may happen as a result of a race condition when the plugin is going | 2236 // This may happen as a result of a race condition when the plugin is going |
2236 // away. | 2237 // away. |
| 2238 wchar_t window_title[MAX_PATH + 1] = {0}; |
| 2239 if (!IsWindow(hwnd) || |
| 2240 !GetWindowText(hwnd, window_title, arraysize(window_title)) || |
| 2241 lstrcmpiW(window_title, kDummyActivationWindowName) != 0) { |
2237 return; | 2242 return; |
2238 } | 2243 } |
2239 | 2244 |
2240 SetParent(hwnd, reinterpret_cast<HWND>(GetNativeViewId())); | 2245 SetParent(hwnd, reinterpret_cast<HWND>(GetNativeViewId())); |
2241 dummy_windows_for_activation_.push_back(hwnd); | 2246 dummy_windows_for_activation_.push_back(hwnd); |
2242 } | 2247 } |
2243 | 2248 |
2244 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowDestroyed( | 2249 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowDestroyed( |
2245 gfx::NativeViewId dummy_activation_window) { | 2250 gfx::NativeViewId dummy_activation_window) { |
2246 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); | 2251 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 if (!is_threaded_compositing_enabled_) | 2595 if (!is_threaded_compositing_enabled_) |
2591 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2596 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
2592 } | 2597 } |
2593 | 2598 |
2594 #if defined(USE_AURA) | 2599 #if defined(USE_AURA) |
2595 | 2600 |
2596 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2601 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
2597 #if defined(OS_WIN) | 2602 #if defined(OS_WIN) |
2598 HWND hwnd = reinterpret_cast<HWND>(new_parent); | 2603 HWND hwnd = reinterpret_cast<HWND>(new_parent); |
2599 if (!hwnd) | 2604 if (!hwnd) |
2600 hwnd = webkit::npapi::GetDefaultWindowParent(); | 2605 hwnd = GetDesktopWindow(); |
2601 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); | 2606 for (std::list<HWND>::iterator i = dummy_windows_for_activation_.begin(); |
2602 i != dummy_windows_for_activation_.end(); ++i) { | 2607 i != dummy_windows_for_activation_.end(); ++i) { |
2603 SetParent(*i, hwnd); | 2608 SetParent(*i, hwnd); |
2604 } | 2609 } |
2605 #endif | 2610 #endif |
2606 } | 2611 } |
2607 | 2612 |
2608 #endif | 2613 #endif |
2609 | 2614 |
2610 void RenderWidgetHostImpl::DelayedAutoResized() { | 2615 void RenderWidgetHostImpl::DelayedAutoResized() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 int process_id = (b->first.second >> 32) & 0xffffffff; | 2734 int process_id = (b->first.second >> 32) & 0xffffffff; |
2730 RenderWidgetHost* rwh = | 2735 RenderWidgetHost* rwh = |
2731 RenderWidgetHost::FromID(process_id, routing_id); | 2736 RenderWidgetHost::FromID(process_id, routing_id); |
2732 if (!rwh) | 2737 if (!rwh) |
2733 continue; | 2738 continue; |
2734 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); | 2739 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); |
2735 } | 2740 } |
2736 } | 2741 } |
2737 | 2742 |
2738 } // namespace content | 2743 } // namespace content |
OLD | NEW |