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/plugin/webplugin_delegate_stub.h" | 5 #include "content/plugin/webplugin_delegate_stub.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 AddRef(); | 91 AddRef(); |
92 | 92 |
93 bool handled = true; | 93 bool handled = true; |
94 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) | 94 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) |
95 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) | 95 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) |
96 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) | 96 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) |
97 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) | 97 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) |
98 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) | 98 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) |
99 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) | 99 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) |
100 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) | 100 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) |
101 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, | |
102 OnDidFinishLoadWithReason) | |
103 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) | 101 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) |
104 IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent) | 102 IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent) |
105 IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) | 103 IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) |
106 IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint) | 104 IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint) |
107 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, | 105 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, |
108 OnGetPluginScriptableObject) | 106 OnGetPluginScriptableObject) |
109 IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue) | 107 IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue) |
110 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) | 108 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) |
111 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry) | 109 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry) |
112 IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, | |
113 OnSendJavaScriptStream) | |
114 IPC_MESSAGE_HANDLER(PluginMsg_SetContentAreaFocus, OnSetContentAreaFocus) | 110 IPC_MESSAGE_HANDLER(PluginMsg_SetContentAreaFocus, OnSetContentAreaFocus) |
115 #if defined(OS_WIN) && !defined(USE_AURA) | 111 #if defined(OS_WIN) && !defined(USE_AURA) |
116 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionUpdated, | 112 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionUpdated, |
117 OnImeCompositionUpdated) | 113 OnImeCompositionUpdated) |
118 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, | 114 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, |
119 OnImeCompositionCompleted) | 115 OnImeCompositionCompleted) |
120 #endif | 116 #endif |
121 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
122 IPC_MESSAGE_HANDLER(PluginMsg_SetWindowFocus, OnSetWindowFocus) | 118 IPC_MESSAGE_HANDLER(PluginMsg_SetWindowFocus, OnSetWindowFocus) |
123 IPC_MESSAGE_HANDLER(PluginMsg_ContainerHidden, OnContainerHidden) | 119 IPC_MESSAGE_HANDLER(PluginMsg_ContainerHidden, OnContainerHidden) |
124 IPC_MESSAGE_HANDLER(PluginMsg_ContainerShown, OnContainerShown) | 120 IPC_MESSAGE_HANDLER(PluginMsg_ContainerShown, OnContainerShown) |
125 IPC_MESSAGE_HANDLER(PluginMsg_WindowFrameChanged, OnWindowFrameChanged) | 121 IPC_MESSAGE_HANDLER(PluginMsg_WindowFrameChanged, OnWindowFrameChanged) |
126 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, | 122 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, |
127 OnImeCompositionCompleted) | 123 OnImeCompositionCompleted) |
128 #endif | 124 #endif |
129 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, | |
130 OnDidReceiveManualResponse) | |
131 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) | |
132 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, | |
133 OnDidFinishManualLoading) | |
134 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) | |
135 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, | |
136 OnHandleURLRequestReply) | |
137 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, | |
138 OnHTTPRangeRequestReply) | |
139 IPC_MESSAGE_HANDLER(PluginMsg_FetchURL, OnFetchURL) | |
140 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
141 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
142 | 127 |
143 if (!in_destructor_) | 128 if (!in_destructor_) |
144 Release(); | 129 Release(); |
145 | 130 |
146 DCHECK(handled); | 131 DCHECK(handled); |
147 return handled; | 132 return handled; |
148 } | 133 } |
149 | 134 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 224 } |
240 | 225 |
241 void WebPluginDelegateStub::OnDidFail(int id) { | 226 void WebPluginDelegateStub::OnDidFail(int id) { |
242 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 227 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
243 if (!client) | 228 if (!client) |
244 return; | 229 return; |
245 | 230 |
246 client->DidFail(id); | 231 client->DidFail(id); |
247 } | 232 } |
248 | 233 |
249 void WebPluginDelegateStub::OnDidFinishLoadWithReason( | |
250 const GURL& url, int reason, int notify_id) { | |
251 delegate_->DidFinishLoadWithReason(url, reason, notify_id); | |
252 } | |
253 | |
254 void WebPluginDelegateStub::OnSetFocus(bool focused) { | 234 void WebPluginDelegateStub::OnSetFocus(bool focused) { |
255 delegate_->SetFocus(focused); | 235 delegate_->SetFocus(focused); |
256 #if defined(OS_WIN) && !defined(USE_AURA) | 236 #if defined(OS_WIN) && !defined(USE_AURA) |
257 if (focused) | 237 if (focused) |
258 webplugin_->UpdateIMEStatus(); | 238 webplugin_->UpdateIMEStatus(); |
259 #endif | 239 #endif |
260 } | 240 } |
261 | 241 |
262 void WebPluginDelegateStub::OnHandleInputEvent( | 242 void WebPluginDelegateStub::OnHandleInputEvent( |
263 const blink::WebInputEvent *event, | 243 const blink::WebInputEvent *event, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 285 } |
306 | 286 |
307 void WebPluginDelegateStub::OnGetFormValue(base::string16* value, | 287 void WebPluginDelegateStub::OnGetFormValue(base::string16* value, |
308 bool* success) { | 288 bool* success) { |
309 *success = false; | 289 *success = false; |
310 if (!delegate_) | 290 if (!delegate_) |
311 return; | 291 return; |
312 *success = delegate_->GetFormValue(value); | 292 *success = delegate_->GetFormValue(value); |
313 } | 293 } |
314 | 294 |
315 void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, | |
316 const std::string& result, | |
317 bool success, | |
318 int notify_id) { | |
319 delegate_->SendJavaScriptStream(url, result, success, notify_id); | |
320 } | |
321 | |
322 void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { | 295 void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { |
323 if (delegate_) | 296 if (delegate_) |
324 delegate_->SetContentAreaHasFocus(has_focus); | 297 delegate_->SetContentAreaHasFocus(has_focus); |
325 } | 298 } |
326 | 299 |
327 #if defined(OS_WIN) && !defined(USE_AURA) | 300 #if defined(OS_WIN) && !defined(USE_AURA) |
328 void WebPluginDelegateStub::OnImeCompositionUpdated( | 301 void WebPluginDelegateStub::OnImeCompositionUpdated( |
329 const base::string16& text, | 302 const base::string16& text, |
330 const std::vector<int>& clauses, | 303 const std::vector<int>& clauses, |
331 const std::vector<int>& target, | 304 const std::vector<int>& target, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 delegate_->WindowFrameChanged(window_frame, view_frame); | 342 delegate_->WindowFrameChanged(window_frame, view_frame); |
370 } | 343 } |
371 | 344 |
372 void WebPluginDelegateStub::OnImeCompositionCompleted( | 345 void WebPluginDelegateStub::OnImeCompositionCompleted( |
373 const base::string16& text) { | 346 const base::string16& text) { |
374 if (delegate_) | 347 if (delegate_) |
375 delegate_->ImeCompositionCompleted(text); | 348 delegate_->ImeCompositionCompleted(text); |
376 } | 349 } |
377 #endif // OS_MACOSX | 350 #endif // OS_MACOSX |
378 | 351 |
379 void WebPluginDelegateStub::OnDidReceiveManualResponse( | |
380 const GURL& url, | |
381 const PluginMsg_DidReceiveResponseParams& params) { | |
382 delegate_->DidReceiveManualResponse(url, params.mime_type, params.headers, | |
383 params.expected_length, | |
384 params.last_modified); | |
385 } | |
386 | |
387 void WebPluginDelegateStub::OnDidReceiveManualData( | |
388 const std::vector<char>& buffer) { | |
389 delegate_->DidReceiveManualData(&buffer.front(), | |
390 static_cast<int>(buffer.size())); | |
391 } | |
392 | |
393 void WebPluginDelegateStub::OnDidFinishManualLoading() { | |
394 delegate_->DidFinishManualLoading(); | |
395 } | |
396 | |
397 void WebPluginDelegateStub::OnDidManualLoadFail() { | |
398 delegate_->DidManualLoadFail(); | |
399 } | |
400 | |
401 void WebPluginDelegateStub::OnHandleURLRequestReply( | |
402 unsigned long resource_id, const GURL& url, int notify_id) { | |
403 WebPluginResourceClient* resource_client = | |
404 delegate_->CreateResourceClient(resource_id, url, notify_id); | |
405 webplugin_->OnResourceCreated(resource_id, resource_client); | |
406 } | |
407 | |
408 void WebPluginDelegateStub::OnHTTPRangeRequestReply( | |
409 unsigned long resource_id, int range_request_id) { | |
410 WebPluginResourceClient* resource_client = | |
411 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); | |
412 webplugin_->OnResourceCreated(resource_id, resource_client); | |
413 } | |
414 | |
415 void WebPluginDelegateStub::OnFetchURL( | |
416 const PluginMsg_FetchURL_Params& params) { | |
417 const char* data = NULL; | |
418 if (params.post_data.size()) | |
419 data = ¶ms.post_data[0]; | |
420 | |
421 delegate_->FetchURL(params.resource_id, | |
422 params.notify_id, | |
423 params.url, | |
424 params.first_party_for_cookies, | |
425 params.method, | |
426 data, | |
427 static_cast<unsigned int>(params.post_data.size()), | |
428 Referrer(params.referrer, params.referrer_policy), | |
429 params.notify_redirect, | |
430 params.is_plugin_src_load, | |
431 channel_->renderer_id(), | |
432 params.render_frame_id, | |
433 webplugin_->host_render_view_routing_id()); | |
434 } | |
435 | |
436 } // namespace content | 352 } // namespace content |
OLD | NEW |