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

Side by Side Diff: webkit/plugins/ppapi/ppapi_webplugin_impl.cc

Issue 10093011: Show a replacement plug-in for loading errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 7 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
« no previous file with comments | « webkit/plugins/ppapi/plugin_delegate.h ('k') | webkit/support/test_webplugin_page_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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;
30 using WebKit::WebPluginContainer; 31 using WebKit::WebPluginContainer;
31 using WebKit::WebPluginParams; 32 using WebKit::WebPluginParams;
32 using WebKit::WebPoint; 33 using WebKit::WebPoint;
33 using WebKit::WebRect; 34 using WebKit::WebRect;
34 using WebKit::WebString; 35 using WebKit::WebString;
35 using WebKit::WebURL; 36 using WebKit::WebURL;
36 using WebKit::WebVector; 37 using WebKit::WebVector;
37 using WebKit::WebView; 38 using WebKit::WebView;
38 39
39 namespace webkit { 40 namespace webkit {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return false; 78 return false;
78 79
79 bool success = instance_->Initialize(container, 80 bool success = instance_->Initialize(container,
80 init_data_->arg_names, 81 init_data_->arg_names,
81 init_data_->arg_values, 82 init_data_->arg_values,
82 init_data_->url, 83 init_data_->url,
83 full_frame_); 84 full_frame_);
84 if (!success) { 85 if (!success) {
85 instance_->Delete(); 86 instance_->Delete();
86 instance_ = NULL; 87 instance_ = NULL;
87 return false; 88
89 WebKit::WebPlugin* replacement_plugin =
90 init_data_->delegate->CreatePluginReplacement(
91 init_data_->module->path());
92 if (!replacement_plugin || !replacement_plugin->initialize(container))
93 return false;
94
95 container->setPlugin(replacement_plugin);
96 return true;
88 } 97 }
89 98
90 init_data_.reset(); 99 init_data_.reset();
91 return true; 100 return true;
92 } 101 }
93 102
94 void WebPluginImpl::destroy() { 103 void WebPluginImpl::destroy() {
95 if (instance_) { 104 if (instance_) {
96 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); 105 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_);
97 instance_object_ = PP_MakeUndefined(); 106 instance_object_ = PP_MakeUndefined();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 bool WebPluginImpl::canRotateView() { 275 bool WebPluginImpl::canRotateView() {
267 return instance_->CanRotateView(); 276 return instance_->CanRotateView();
268 } 277 }
269 278
270 void WebPluginImpl::rotateView(RotationType type) { 279 void WebPluginImpl::rotateView(RotationType type) {
271 instance_->RotateView(type); 280 instance_->RotateView(type);
272 } 281 }
273 282
274 } // namespace ppapi 283 } // namespace ppapi
275 } // namespace webkit 284 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_delegate.h ('k') | webkit/support/test_webplugin_page_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698