| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/plugin/webplugin_delegate_stub.h" | 5 #include "chrome/plugin/webplugin_delegate_stub.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/gfx/platform_device_win.h" | 9 #include "base/gfx/platform_device_win.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) | 73 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) |
| 74 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) | 74 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) |
| 75 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) | 75 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) |
| 76 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) | 76 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) |
| 77 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) | 77 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) |
| 78 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) | 78 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) |
| 79 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, | 79 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, |
| 80 OnDidFinishLoadWithReason) | 80 OnDidFinishLoadWithReason) |
| 81 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) | 81 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) |
| 82 IPC_MESSAGE_HANDLER(PluginMsg_HandleEvent, OnHandleEvent) | 82 IPC_MESSAGE_HANDLER(PluginMsg_HandleEvent, OnHandleEvent) |
| 83 IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) |
| 84 IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint) |
| 83 IPC_MESSAGE_HANDLER(PluginMsg_Print, OnPrint) | 85 IPC_MESSAGE_HANDLER(PluginMsg_Print, OnPrint) |
| 84 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, | 86 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, |
| 85 OnGetPluginScriptableObject) | 87 OnGetPluginScriptableObject) |
| 86 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) | 88 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) |
| 87 IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, | 89 IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, |
| 88 OnSendJavaScriptStream) | 90 OnSendJavaScriptStream) |
| 89 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, | 91 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, |
| 90 OnDidReceiveManualResponse) | 92 OnDidReceiveManualResponse) |
| 91 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) | 93 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) |
| 92 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, | 94 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void WebPluginDelegateStub::OnSetFocus() { | 194 void WebPluginDelegateStub::OnSetFocus() { |
| 193 delegate_->SetFocus(); | 195 delegate_->SetFocus(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void WebPluginDelegateStub::OnHandleEvent(const NPEvent& event, | 198 void WebPluginDelegateStub::OnHandleEvent(const NPEvent& event, |
| 197 bool* handled, | 199 bool* handled, |
| 198 WebCursor* cursor) { | 200 WebCursor* cursor) { |
| 199 *handled = delegate_->HandleEvent(const_cast<NPEvent*>(&event), cursor); | 201 *handled = delegate_->HandleEvent(const_cast<NPEvent*>(&event), cursor); |
| 200 } | 202 } |
| 201 | 203 |
| 204 void WebPluginDelegateStub::OnPaint(const gfx::Rect& damaged_rect) { |
| 205 webplugin_->Paint(damaged_rect); |
| 206 } |
| 207 |
| 208 void WebPluginDelegateStub::OnDidPaint() { |
| 209 webplugin_->DidPaint(); |
| 210 } |
| 211 |
| 202 void WebPluginDelegateStub::OnPrint(PluginMsg_PrintResponse_Params* params) { | 212 void WebPluginDelegateStub::OnPrint(PluginMsg_PrintResponse_Params* params) { |
| 203 gfx::Emf emf; | 213 gfx::Emf emf; |
| 204 if (!emf.CreateDc(NULL, NULL)) { | 214 if (!emf.CreateDc(NULL, NULL)) { |
| 205 NOTREACHED(); | 215 NOTREACHED(); |
| 206 return; | 216 return; |
| 207 } | 217 } |
| 208 HDC hdc = emf.hdc(); | 218 HDC hdc = emf.hdc(); |
| 209 gfx::PlatformDeviceWin::InitializeDC(hdc); | 219 gfx::PlatformDeviceWin::InitializeDC(hdc); |
| 210 delegate_->Print(hdc); | 220 delegate_->Print(hdc); |
| 211 if (!emf.CloseDc()) { | 221 if (!emf.CloseDc()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 222 // Retrieve a copy of the data. | 232 // Retrieve a copy of the data. |
| 223 bool success = emf.GetData(shared_buf.memory(), size); | 233 bool success = emf.GetData(shared_buf.memory(), size); |
| 224 DCHECK(success); | 234 DCHECK(success); |
| 225 } | 235 } |
| 226 | 236 |
| 227 void WebPluginDelegateStub::OnUpdateGeometry( | 237 void WebPluginDelegateStub::OnUpdateGeometry( |
| 228 const gfx::Rect& window_rect, | 238 const gfx::Rect& window_rect, |
| 229 const gfx::Rect& clip_rect, | 239 const gfx::Rect& clip_rect, |
| 230 bool visible, | 240 bool visible, |
| 231 const SharedMemoryHandle& windowless_buffer, | 241 const SharedMemoryHandle& windowless_buffer, |
| 232 const SharedMemoryLock& lock) { | 242 const SharedMemoryHandle& background_buffer) { |
| 233 webplugin_->UpdateGeometry( | 243 webplugin_->UpdateGeometry( |
| 234 window_rect, clip_rect, visible, windowless_buffer, lock); | 244 window_rect, clip_rect, visible, windowless_buffer, background_buffer); |
| 235 } | 245 } |
| 236 | 246 |
| 237 void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id, | 247 void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id, |
| 238 void** npobject_ptr) { | 248 void** npobject_ptr) { |
| 239 NPObject* object = delegate_->GetPluginScriptableObject(); | 249 NPObject* object = delegate_->GetPluginScriptableObject(); |
| 240 if (!object) { | 250 if (!object) { |
| 241 *route_id = MSG_ROUTING_NONE; | 251 *route_id = MSG_ROUTING_NONE; |
| 242 return; | 252 return; |
| 243 } | 253 } |
| 244 | 254 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 params.stream); | 331 params.stream); |
| 322 webplugin_->OnResourceCreated(params.resource_id, resource_client); | 332 webplugin_->OnResourceCreated(params.resource_id, resource_client); |
| 323 } | 333 } |
| 324 | 334 |
| 325 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url, | 335 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url, |
| 326 bool notify_needed, | 336 bool notify_needed, |
| 327 HANDLE notify_data) { | 337 HANDLE notify_data) { |
| 328 delegate_->URLRequestRouted(url, notify_needed, notify_data); | 338 delegate_->URLRequestRouted(url, notify_needed, notify_data); |
| 329 } | 339 } |
| 330 | 340 |
| OLD | NEW |