| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) { | 185 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) { |
| 186 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); | 186 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); |
| 187 if (!gpu_process_host) | 187 if (!gpu_process_host) |
| 188 return; | 188 return; |
| 189 | 189 |
| 190 gpu_process_host->Send(message.release()); | 190 gpu_process_host->Send(message.release()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void PostTaskOnIOThread(const tracked_objects::Location& from_here, | |
| 194 base::Closure task) { | |
| 195 BrowserThread::PostTask(BrowserThread::IO, from_here, task); | |
| 196 gpu_process_host->Send(message.release()); | |
| 197 } | |
| 198 | |
| 199 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, | 193 bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, |
| 200 content::PageZoom* zoom, | 194 content::PageZoom* zoom, |
| 201 POINT* zoom_center) { | 195 POINT* zoom_center) { |
| 202 static long start = 0; | 196 static long start = 0; |
| 203 static POINT zoom_first; | 197 static POINT zoom_first; |
| 204 | 198 |
| 205 if (gi.dwFlags == GF_BEGIN) { | 199 if (gi.dwFlags == GF_BEGIN) { |
| 206 start = gi.ullArguments; | 200 start = gi.ullArguments; |
| 207 zoom_first.x = gi.ptsLocation.x; | 201 zoom_first.x = gi.ptsLocation.x; |
| 208 zoom_first.y = gi.ptsLocation.y; | 202 zoom_first.y = gi.ptsLocation.y; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // chrome_content_client.cc ChromeContentClient::SandboxPlugin | 541 // chrome_content_client.cc ChromeContentClient::SandboxPlugin |
| 548 ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); | 542 ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL); |
| 549 ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); | 543 ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL); |
| 550 ChangeWindowMessageFilterEx(parent, WM_APPCOMMAND, MSGFLT_ALLOW, NULL); | 544 ChangeWindowMessageFilterEx(parent, WM_APPCOMMAND, MSGFLT_ALLOW, NULL); |
| 551 ::RemovePropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp); | 545 ::RemovePropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp); |
| 552 } | 546 } |
| 553 ::SetParent(window, parent); | 547 ::SetParent(window, parent); |
| 554 // How many times we try to find a PluginProcessHost whose process matches | 548 // How many times we try to find a PluginProcessHost whose process matches |
| 555 // the HWND. | 549 // the HWND. |
| 556 static const int kMaxTries = 5; | 550 static const int kMaxTries = 5; |
| 557 BrowserThread::PostTask( | 551 BrowserThread::PostTaskOnIOThread( |
| 558 BrowserThread::IO, | |
| 559 FROM_HERE, | 552 FROM_HERE, |
| 560 base::Bind(&NotifyPluginProcessHostHelper, window, parent, kMaxTries)); | 553 base::Bind(&NotifyPluginProcessHostHelper, window, parent, kMaxTries)); |
| 561 return parent; | 554 return parent; |
| 562 } | 555 } |
| 563 | 556 |
| 564 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 557 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
| 565 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); | 558 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); |
| 566 vector->push_back(hwnd); | 559 vector->push_back(hwnd); |
| 567 return TRUE; | 560 return TRUE; |
| 568 } | 561 } |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 scoped_ptr<IPC::Message> message( | 2045 scoped_ptr<IPC::Message> message( |
| 2053 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); | 2046 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); |
| 2054 base::Closure acknowledge_task = base::Bind( | 2047 base::Closure acknowledge_task = base::Bind( |
| 2055 SendToGpuProcessHost, | 2048 SendToGpuProcessHost, |
| 2056 gpu_host_id, | 2049 gpu_host_id, |
| 2057 base::Passed(&message)); | 2050 base::Passed(&message)); |
| 2058 | 2051 |
| 2059 accelerated_surface_->AsyncPresentAndAcknowledge( | 2052 accelerated_surface_->AsyncPresentAndAcknowledge( |
| 2060 params.size, | 2053 params.size, |
| 2061 params.surface_id, | 2054 params.surface_id, |
| 2062 base::Bind(PostTaskOnIOThread, | 2055 base::Bind(BrowserThread::PostTaskOnIOThread, |
| 2063 FROM_HERE, | 2056 FROM_HERE, |
| 2064 acknowledge_task)); | 2057 acknowledge_task)); |
| 2065 } else { | 2058 } else { |
| 2066 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 2059 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
| 2067 } | 2060 } |
| 2068 } | 2061 } |
| 2069 | 2062 |
| 2070 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( | 2063 void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer( |
| 2071 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 2064 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 2072 int gpu_host_id) { | 2065 int gpu_host_id) { |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2492 | 2485 |
| 2493 size_t offset = selection_range_.GetMin() - selection_text_offset_; | 2486 size_t offset = selection_range_.GetMin() - selection_text_offset_; |
| 2494 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), | 2487 memcpy(reinterpret_cast<char*>(reconv) + sizeof(RECONVERTSTRING), |
| 2495 selection_text_.c_str() + offset, len * sizeof(WCHAR)); | 2488 selection_text_.c_str() + offset, len * sizeof(WCHAR)); |
| 2496 | 2489 |
| 2497 // According to Microsft API document, IMR_RECONVERTSTRING and | 2490 // According to Microsft API document, IMR_RECONVERTSTRING and |
| 2498 // IMR_DOCUMENTFEED should return reconv, but some applications return | 2491 // IMR_DOCUMENTFEED should return reconv, but some applications return |
| 2499 // need_size. | 2492 // need_size. |
| 2500 return reinterpret_cast<LRESULT>(reconv); | 2493 return reinterpret_cast<LRESULT>(reconv); |
| 2501 } | 2494 } |
| OLD | NEW |