Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/plugin/webplugin_delegate_stub.cc

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "content/child/npapi/plugin_instance.h"
13 #include "content/child/npapi/webplugin_delegate_impl.h"
12 #include "content/child/plugin_messages.h" 14 #include "content/child/plugin_messages.h"
13 #include "content/plugin/plugin_channel.h" 15 #include "content/plugin/plugin_channel.h"
14 #include "content/plugin/plugin_thread.h" 16 #include "content/plugin/plugin_thread.h"
15 #include "content/plugin/webplugin_proxy.h" 17 #include "content/plugin/webplugin_proxy.h"
16 #include "content/public/common/content_client.h" 18 #include "content/public/common/content_client.h"
17 #include "content/public/common/content_constants.h" 19 #include "content/public/common/content_constants.h"
18 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
19 #include "skia/ext/platform_device.h" 21 #include "skia/ext/platform_device.h"
20 #include "third_party/WebKit/public/web/WebBindings.h" 22 #include "third_party/WebKit/public/web/WebBindings.h"
21 #include "third_party/WebKit/public/web/WebCursorInfo.h" 23 #include "third_party/WebKit/public/web/WebCursorInfo.h"
22 #include "third_party/npapi/bindings/npapi.h" 24 #include "third_party/npapi/bindings/npapi.h"
23 #include "third_party/npapi/bindings/npruntime.h" 25 #include "third_party/npapi/bindings/npruntime.h"
24 #include "webkit/common/cursors/webcursor.h" 26 #include "webkit/common/cursors/webcursor.h"
25 #include "webkit/plugins/npapi/plugin_instance.h"
26 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
27 27
28 using WebKit::WebBindings; 28 using WebKit::WebBindings;
29 using WebKit::WebCursorInfo; 29 using WebKit::WebCursorInfo;
30 using webkit::npapi::WebPlugin;
31 using webkit::npapi::WebPluginResourceClient;
32 30
33 namespace content { 31 namespace content {
34 32
35 static void DestroyWebPluginAndDelegate( 33 static void DestroyWebPluginAndDelegate(
36 base::WeakPtr<NPObjectStub> scriptable_object, 34 base::WeakPtr<NPObjectStub> scriptable_object,
37 webkit::npapi::WebPluginDelegateImpl* delegate, 35 WebPluginDelegateImpl* delegate,
38 WebPlugin* webplugin) { 36 WebPlugin* webplugin) {
39 // The plugin may not expect us to try to release the scriptable object 37 // The plugin may not expect us to try to release the scriptable object
40 // after calling NPP_Destroy on the instance, so delete the stub now. 38 // after calling NPP_Destroy on the instance, so delete the stub now.
41 if (scriptable_object.get()) 39 if (scriptable_object.get())
42 scriptable_object->DeleteSoon(); 40 scriptable_object->DeleteSoon();
43 41
44 if (delegate) { 42 if (delegate) {
45 // Save the object owner Id so we can unregister it as a valid owner 43 // Save the object owner Id so we can unregister it as a valid owner
46 // after the instance has been destroyed. 44 // after the instance has been destroyed.
47 NPP owner = delegate->GetPluginNPP(); 45 NPP owner = delegate->GetPluginNPP();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 173 }
176 174
177 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 175 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
178 base::FilePath path = 176 base::FilePath path =
179 command_line.GetSwitchValuePath(switches::kPluginPath); 177 command_line.GetSwitchValuePath(switches::kPluginPath);
180 178
181 webplugin_ = new WebPluginProxy(channel_.get(), 179 webplugin_ = new WebPluginProxy(channel_.get(),
182 instance_id_, 180 instance_id_,
183 page_url_, 181 page_url_,
184 params.host_render_view_routing_id); 182 params.host_render_view_routing_id);
185 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create(path, mime_type_); 183 delegate_ = WebPluginDelegateImpl::Create(path, mime_type_);
186 if (delegate_) { 184 if (delegate_) {
187 webplugin_->set_delegate(delegate_); 185 webplugin_->set_delegate(delegate_);
188 std::vector<std::string> arg_names = params.arg_names; 186 std::vector<std::string> arg_names = params.arg_names;
189 std::vector<std::string> arg_values = params.arg_values; 187 std::vector<std::string> arg_values = params.arg_values;
190 188
191 // Register the plugin as a valid object owner. 189 // Register the plugin as a valid object owner.
192 WebBindings::registerObjectOwner(delegate_->GetPluginNPP()); 190 WebBindings::registerObjectOwner(delegate_->GetPluginNPP());
193 191
194 // Add an NPObject owner mapping for this instance, to support ownership 192 // Add an NPObject owner mapping for this instance, to support ownership
195 // tracking in the renderer. 193 // tracking in the renderer.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 411 }
414 412
415 void WebPluginDelegateStub::OnHTTPRangeRequestReply( 413 void WebPluginDelegateStub::OnHTTPRangeRequestReply(
416 unsigned long resource_id, int range_request_id) { 414 unsigned long resource_id, int range_request_id) {
417 WebPluginResourceClient* resource_client = 415 WebPluginResourceClient* resource_client =
418 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); 416 delegate_->CreateSeekableResourceClient(resource_id, range_request_id);
419 webplugin_->OnResourceCreated(resource_id, resource_client); 417 webplugin_->OnResourceCreated(resource_id, resource_client);
420 } 418 }
421 419
422 } // namespace content 420 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698