OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
23 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 23 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
24 #include "webkit/glue/webcursor.h" | 24 #include "webkit/glue/webcursor.h" |
25 | 25 |
26 #if defined(ENABLE_GPU) | 26 #if defined(ENABLE_GPU) |
27 #include "app/gfx/gl/gl_context.h" | 27 #include "app/gfx/gl/gl_context.h" |
28 #endif | 28 #endif |
29 | 29 |
30 using WebKit::WebBindings; | 30 using WebKit::WebBindings; |
31 using WebKit::WebCursorInfo; | 31 using WebKit::WebCursorInfo; |
32 using webkit::npapi::WebPlugin; | 32 using webkit_glue::WebPlugin; |
33 using webkit::npapi::WebPluginResourceClient; | 33 using webkit_glue::WebPluginResourceClient; |
34 | 34 |
35 class FinishDestructionTask : public Task { | 35 class FinishDestructionTask : public Task { |
36 public: | 36 public: |
37 FinishDestructionTask(webkit::npapi::WebPluginDelegateImpl* delegate, | 37 FinishDestructionTask(WebPluginDelegateImpl* delegate, WebPlugin* webplugin) |
38 WebPlugin* webplugin) | 38 : delegate_(delegate), webplugin_(webplugin) { } |
39 : delegate_(delegate), webplugin_(webplugin) { | |
40 } | |
41 | 39 |
42 void Run() { | 40 void Run() { |
43 // WebPlugin must outlive WebPluginDelegate. | 41 // WebPlugin must outlive WebPluginDelegate. |
44 if (delegate_) | 42 if (delegate_) |
45 delegate_->PluginDestroyed(); | 43 delegate_->PluginDestroyed(); |
46 | 44 |
47 delete webplugin_; | 45 delete webplugin_; |
48 } | 46 } |
49 | 47 |
50 private: | 48 private: |
51 webkit::npapi::WebPluginDelegateImpl* delegate_; | 49 WebPluginDelegateImpl* delegate_; |
52 webkit::npapi::WebPlugin* webplugin_; | 50 WebPlugin* webplugin_; |
53 }; | 51 }; |
54 | 52 |
55 WebPluginDelegateStub::WebPluginDelegateStub( | 53 WebPluginDelegateStub::WebPluginDelegateStub( |
56 const std::string& mime_type, int instance_id, PluginChannel* channel) : | 54 const std::string& mime_type, int instance_id, PluginChannel* channel) : |
57 mime_type_(mime_type), | 55 mime_type_(mime_type), |
58 instance_id_(instance_id), | 56 instance_id_(instance_id), |
59 channel_(channel), | 57 channel_(channel), |
60 delegate_(NULL), | 58 delegate_(NULL), |
61 webplugin_(NULL), | 59 webplugin_(NULL), |
62 in_destructor_(false) { | 60 in_destructor_(false) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // The problem is that the XID can change at arbitrary times (e.g. when the | 178 // The problem is that the XID can change at arbitrary times (e.g. when the |
181 // tab is detached then reattached), so we need to be able to track these | 179 // tab is detached then reattached), so we need to be able to track these |
182 // changes, and let the PluginInstance know. | 180 // changes, and let the PluginInstance know. |
183 // PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId( | 181 // PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId( |
184 // params.containing_window, &parent)); | 182 // params.containing_window, &parent)); |
185 #endif | 183 #endif |
186 | 184 |
187 webplugin_ = new WebPluginProxy( | 185 webplugin_ = new WebPluginProxy( |
188 channel_, instance_id_, page_url_, params.containing_window, | 186 channel_, instance_id_, page_url_, params.containing_window, |
189 params.host_render_view_routing_id); | 187 params.host_render_view_routing_id); |
190 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create( | 188 delegate_ = WebPluginDelegateImpl::Create(path, mime_type_, parent); |
191 path, mime_type_, parent); | |
192 if (delegate_) { | 189 if (delegate_) { |
193 webplugin_->set_delegate(delegate_); | 190 webplugin_->set_delegate(delegate_); |
194 *result = delegate_->Initialize(params.url, | 191 *result = delegate_->Initialize(params.url, |
195 params.arg_names, | 192 params.arg_names, |
196 params.arg_values, | 193 params.arg_values, |
197 webplugin_, | 194 webplugin_, |
198 params.load_manually); | 195 params.load_manually); |
199 } | 196 } |
200 } | 197 } |
201 | 198 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 webplugin_->OnResourceCreated(resource_id, resource_client); | 467 webplugin_->OnResourceCreated(resource_id, resource_client); |
471 } | 468 } |
472 | 469 |
473 #if defined(OS_MACOSX) | 470 #if defined(OS_MACOSX) |
474 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( | 471 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( |
475 gfx::PluginWindowHandle window) { | 472 gfx::PluginWindowHandle window) { |
476 delegate_->set_windowed_handle(window); | 473 delegate_->set_windowed_handle(window); |
477 } | 474 } |
478 #endif | 475 #endif |
479 | 476 |
OLD | NEW |