| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 case WM_MBUTTONDOWN: | 191 case WM_MBUTTONDOWN: |
| 192 ::SendMessage(GetParent(window), message, wparam, lparam); | 192 ::SendMessage(GetParent(window), message, wparam, lparam); |
| 193 return 0; | 193 return 0; |
| 194 default: | 194 default: |
| 195 break; | 195 break; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 return ::DefWindowProc(window, message, wparam, lparam); | 198 return ::DefWindowProc(window, message, wparam, lparam); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void SendToGpuProcessHost(int gpu_host_id, IPC::Message* message) { | |
| 202 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); | |
| 203 if (!gpu_process_host) { | |
| 204 delete message; | |
| 205 return; | |
| 206 } | |
| 207 | |
| 208 gpu_process_host->Send(message); | |
| 209 } | |
| 210 | |
| 211 void PostTaskOnIOThread(const tracked_objects::Location& from_here, | |
| 212 base::Closure task) { | |
| 213 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task); | |
| 214 } | |
| 215 | |
| 216 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, | 201 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, |
| 217 content::PageZoom* zoom, | 202 content::PageZoom* zoom, |
| 218 POINT* zoom_center) { | 203 POINT* zoom_center) { |
| 219 static long start = 0; | 204 static long start = 0; |
| 220 static POINT zoom_first; | 205 static POINT zoom_first; |
| 221 | 206 |
| 222 if (gi.dwFlags == GF_BEGIN) { | 207 if (gi.dwFlags == GF_BEGIN) { |
| 223 start = gi.ullArguments; | 208 start = gi.ullArguments; |
| 224 zoom_first.x = gi.ptsLocation.x; | 209 zoom_first.x = gi.ptsLocation.x; |
| 225 zoom_first.y = gi.ptsLocation.y; | 210 zoom_first.y = gi.ptsLocation.y; |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); | 2058 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
| 2074 } | 2059 } |
| 2075 } else { | 2060 } else { |
| 2076 hide_compositor_window_at_next_paint_ = true; | 2061 hide_compositor_window_at_next_paint_ = true; |
| 2077 } | 2062 } |
| 2078 } | 2063 } |
| 2079 | 2064 |
| 2080 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( | 2065 void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( |
| 2081 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 2066 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 2082 int gpu_host_id) { | 2067 int gpu_host_id) { |
| 2083 if (!accelerated_surface_.get() && compositor_host_window_) { | 2068 if (params.surface_id) { |
| 2084 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); | 2069 if (!accelerated_surface_.get() && compositor_host_window_) { |
| 2085 accelerated_surface_->Initialize(); | 2070 accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); |
| 2071 accelerated_surface_->Initialize(); |
| 2072 } |
| 2073 |
| 2074 accelerated_surface_->AsyncPresentAndAcknowledge( |
| 2075 params.size, |
| 2076 params.surface_id, |
| 2077 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers, |
| 2078 gpu_host_id, |
| 2079 params.route_id)); |
| 2080 } else { |
| 2081 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
| 2086 } | 2082 } |
| 2087 | |
| 2088 base::Closure acknowledge_task = | |
| 2089 base::Bind(SendToGpuProcessHost, | |
| 2090 gpu_host_id, | |
| 2091 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); | |
| 2092 | |
| 2093 accelerated_surface_->AsyncPresentAndAcknowledge( | |
| 2094 params.size, | |
| 2095 params.surface_id, | |
| 2096 base::Bind(PostTaskOnIOThread, | |
| 2097 FROM_HERE, | |
| 2098 acknowledge_task)); | |
| 2099 } | 2083 } |
| 2100 | 2084 |
| 2101 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( | 2085 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( |
| 2102 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 2086 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 2103 int gpu_host_id) { | 2087 int gpu_host_id) { |
| 2104 NOTREACHED(); | 2088 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
| 2105 } | 2089 } |
| 2106 | 2090 |
| 2107 void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) { | 2091 void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) { |
| 2108 if (!render_widget_host_) | 2092 if (!render_widget_host_) |
| 2109 return; | 2093 return; |
| 2110 | 2094 |
| 2111 render_widget_host_->AccessibilitySetFocus(acc_obj_id); | 2095 render_widget_host_->AccessibilitySetFocus(acc_obj_id); |
| 2112 } | 2096 } |
| 2113 | 2097 |
| 2114 void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) { | 2098 void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 | 2464 |
| 2481 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2465 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
| 2482 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2466 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
| 2483 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2467 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
| 2484 | 2468 |
| 2485 // According to Microsft API document, IMR_RECONVERTSTRING and | 2469 // According to Microsft API document, IMR_RECONVERTSTRING and |
| 2486 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2470 // IMR_DOCUMENTFEED should return reconv, but some applications return |
| 2487 // need_size. | 2471 // need_size. |
| 2488 return reinterpret_cast<LRESULT>(reconv); | 2472 return reinterpret_cast<LRESULT>(reconv); |
| 2489 } | 2473 } |
| OLD | NEW |