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 "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 5 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "ppapi/shared_impl/ppapi_globals.h" | 11 #include "ppapi/shared_impl/ppapi_globals.h" |
12 #include "ppapi/shared_impl/var_tracker.h" | 12 #include "ppapi/shared_impl/var_tracker.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
22 #include "webkit/plugins/ppapi/message_channel.h" | 22 #include "webkit/plugins/ppapi/message_channel.h" |
23 #include "webkit/plugins/ppapi/npobject_var.h" | 23 #include "webkit/plugins/ppapi/npobject_var.h" |
24 #include "webkit/plugins/ppapi/plugin_module.h" | 24 #include "webkit/plugins/ppapi/plugin_module.h" |
25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
26 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 26 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
27 | 27 |
28 using ppapi::NPObjectVar; | 28 using ppapi::NPObjectVar; |
29 using WebKit::WebCanvas; | 29 using WebKit::WebCanvas; |
30 using WebKit::WebPlugin; | |
31 using WebKit::WebPluginContainer; | 30 using WebKit::WebPluginContainer; |
32 using WebKit::WebPluginParams; | 31 using WebKit::WebPluginParams; |
33 using WebKit::WebPoint; | 32 using WebKit::WebPoint; |
34 using WebKit::WebRect; | 33 using WebKit::WebRect; |
35 using WebKit::WebString; | 34 using WebKit::WebString; |
36 using WebKit::WebURL; | 35 using WebKit::WebURL; |
37 using WebKit::WebVector; | 36 using WebKit::WebVector; |
38 using WebKit::WebView; | 37 using WebKit::WebView; |
39 | 38 |
40 namespace webkit { | 39 namespace webkit { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return false; | 77 return false; |
79 | 78 |
80 bool success = instance_->Initialize(container, | 79 bool success = instance_->Initialize(container, |
81 init_data_->arg_names, | 80 init_data_->arg_names, |
82 init_data_->arg_values, | 81 init_data_->arg_values, |
83 init_data_->url, | 82 init_data_->url, |
84 full_frame_); | 83 full_frame_); |
85 if (!success) { | 84 if (!success) { |
86 instance_->Delete(); | 85 instance_->Delete(); |
87 instance_ = NULL; | 86 instance_ = NULL; |
88 | 87 return false; |
89 WebKit::WebPlugin* replacement_plugin = | |
90 init_data_->delegate->CreatePluginReplacement( | |
91 init_data_->module->path()); | |
92 if (!replacement_plugin->initialize(container)) | |
93 return false; | |
94 | |
95 container->setPlugin(replacement_plugin); | |
96 return true; | |
97 } | 88 } |
98 | 89 |
99 init_data_.reset(); | 90 init_data_.reset(); |
100 return true; | 91 return true; |
101 } | 92 } |
102 | 93 |
103 void WebPluginImpl::destroy() { | 94 void WebPluginImpl::destroy() { |
104 if (instance_) { | 95 if (instance_) { |
105 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); | 96 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); |
106 instance_object_ = PP_MakeUndefined(); | 97 instance_object_ = PP_MakeUndefined(); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool WebPluginImpl::canRotateView() { | 266 bool WebPluginImpl::canRotateView() { |
276 return instance_->CanRotateView(); | 267 return instance_->CanRotateView(); |
277 } | 268 } |
278 | 269 |
279 void WebPluginImpl::rotateView(RotationType type) { | 270 void WebPluginImpl::rotateView(RotationType type) { |
280 instance_->RotateView(type); | 271 instance_->RotateView(type); |
281 } | 272 } |
282 | 273 |
283 } // namespace ppapi | 274 } // namespace ppapi |
284 } // namespace webkit | 275 } // namespace webkit |
OLD | NEW |