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