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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/common/child_process_logging.h" | 10 #include "chrome/common/child_process_logging.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/plugin_messages.h" | 12 #include "chrome/common/plugin_messages.h" |
13 #include "chrome/plugin/npobject_stub.h" | 13 #include "chrome/plugin/npobject_stub.h" |
14 #include "chrome/plugin/plugin_channel.h" | 14 #include "chrome/plugin/plugin_channel.h" |
15 #include "chrome/plugin/plugin_thread.h" | 15 #include "chrome/plugin/plugin_thread.h" |
16 #include "chrome/plugin/webplugin_proxy.h" | 16 #include "chrome/plugin/webplugin_proxy.h" |
17 #include "printing/native_metafile.h" | 17 #include "printing/native_metafile.h" |
18 #include "third_party/npapi/bindings/npapi.h" | 18 #include "third_party/npapi/bindings/npapi.h" |
19 #include "third_party/npapi/bindings/npruntime.h" | 19 #include "third_party/npapi/bindings/npruntime.h" |
20 #include "skia/ext/platform_device.h" | 20 #include "skia/ext/platform_device.h" |
21 #include "webkit/api/public/WebBindings.h" | 21 #include "webkit/api/public/WebBindings.h" |
22 #include "webkit/api/public/WebCursorInfo.h" | 22 #include "webkit/api/public/WebCursorInfo.h" |
23 #include "webkit/glue/webcursor.h" | 23 #include "webkit/glue/webcursor.h" |
24 #include "webkit/glue/webplugin_delegate.h" | 24 #include "webkit/glue/webplugin_delegate.h" |
25 | 25 |
26 using WebKit::WebBindings; | 26 using WebKit::WebBindings; |
27 using WebKit::WebCursorInfo; | 27 using WebKit::WebCursorInfo; |
| 28 using webkit_glue::WebPlugin; |
| 29 using webkit_glue::WebPluginDelegate; |
| 30 using webkit_glue::WebPluginResourceClient; |
28 | 31 |
29 class FinishDestructionTask : public Task { | 32 class FinishDestructionTask : public Task { |
30 public: | 33 public: |
31 FinishDestructionTask(WebPluginDelegate* delegate, WebPlugin* webplugin) | 34 FinishDestructionTask(WebPluginDelegate* delegate, WebPlugin* webplugin) |
32 : delegate_(delegate), webplugin_(webplugin) { } | 35 : delegate_(delegate), webplugin_(webplugin) { } |
33 | 36 |
34 void Run() { | 37 void Run() { |
35 // WebPlugin must outlive WebPluginDelegate. | 38 // WebPlugin must outlive WebPluginDelegate. |
36 if (delegate_) | 39 if (delegate_) |
37 delegate_->PluginDestroyed(); | 40 delegate_->PluginDestroyed(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #if defined(OS_WIN) | 148 #if defined(OS_WIN) |
146 parent = gfx::NativeViewFromId(params.containing_window); | 149 parent = gfx::NativeViewFromId(params.containing_window); |
147 #elif defined(OS_LINUX) | 150 #elif defined(OS_LINUX) |
148 // This code is disabled, See issue 17110. | 151 // This code is disabled, See issue 17110. |
149 // The problem is that the XID can change at arbitrary times (e.g. when the | 152 // The problem is that the XID can change at arbitrary times (e.g. when the |
150 // tab is detached then reattached), so we need to be able to track these | 153 // tab is detached then reattached), so we need to be able to track these |
151 // changes, and let the PluginInstance know. | 154 // changes, and let the PluginInstance know. |
152 // PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId( | 155 // PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId( |
153 // params.containing_window, &parent)); | 156 // params.containing_window, &parent)); |
154 #endif | 157 #endif |
| 158 |
| 159 webplugin_ = new WebPluginProxy(channel_, instance_id_, page_url_); |
| 160 #if defined(OS_WIN) |
| 161 if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event)) |
| 162 return; |
| 163 #endif |
| 164 |
155 delegate_ = WebPluginDelegate::Create(path, mime_type_, parent); | 165 delegate_ = WebPluginDelegate::Create(path, mime_type_, parent); |
156 | |
157 if (delegate_) { | 166 if (delegate_) { |
158 webplugin_ = new WebPluginProxy( | 167 webplugin_->set_delegate(delegate_); |
159 channel_, instance_id_, delegate_, page_url_); | |
160 #if defined(OS_WIN) | |
161 if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event)) | |
162 return; | |
163 #endif | |
164 *result = delegate_->Initialize( | 168 *result = delegate_->Initialize( |
165 params.url, argn, argv, argc, webplugin_, params.load_manually); | 169 params.url, argn, argv, argc, webplugin_, params.load_manually); |
166 } | 170 } |
167 | 171 |
168 delete[] argn; | 172 delete[] argn; |
169 delete[] argv; | 173 delete[] argv; |
170 } | 174 } |
171 | 175 |
172 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) { | 176 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) { |
173 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 177 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 375 |
372 void WebPluginDelegateStub::OnHandleURLRequestReply( | 376 void WebPluginDelegateStub::OnHandleURLRequestReply( |
373 const PluginMsg_URLRequestReply_Params& params) { | 377 const PluginMsg_URLRequestReply_Params& params) { |
374 WebPluginResourceClient* resource_client = | 378 WebPluginResourceClient* resource_client = |
375 delegate_->CreateResourceClient(params.resource_id, params.url, | 379 delegate_->CreateResourceClient(params.resource_id, params.url, |
376 params.notify_needed, | 380 params.notify_needed, |
377 params.notify_data, | 381 params.notify_data, |
378 params.stream); | 382 params.stream); |
379 webplugin_->OnResourceCreated(params.resource_id, resource_client); | 383 webplugin_->OnResourceCreated(params.resource_id, resource_client); |
380 } | 384 } |
OLD | NEW |