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

Side by Side Diff: webkit/plugins/npapi/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: cleanup Created 8 years, 8 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 "webkit/plugins/npapi/webplugin_impl.h" 5 #include "webkit/plugins/npapi/webplugin_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 // Set the container before Initialize because the plugin may 264 // Set the container before Initialize because the plugin may
265 // synchronously call NPN_GetValue to get its container during its 265 // synchronously call NPN_GetValue to get its container during its
266 // initialization. 266 // initialization.
267 SetContainer(container); 267 SetContainer(container);
268 bool ok = plugin_delegate->Initialize( 268 bool ok = plugin_delegate->Initialize(
269 plugin_url_, arg_names_, arg_values_, this, load_manually_); 269 plugin_url_, arg_names_, arg_values_, this, load_manually_);
270 if (!ok) { 270 if (!ok) {
271 LOG(ERROR) << "Couldn't initialize plug-in"; 271 LOG(ERROR) << "Couldn't initialize plug-in";
272 plugin_delegate->PluginDestroyed(); 272 plugin_delegate->PluginDestroyed();
273 return false; 273
274 WebKit::WebPlugin* replacement_plugin =
275 page_delegate_->CreatePluginReplacement(file_path_);
276 if (!replacement_plugin->initialize(container)) {
277 LOG(ERROR) << "Couldn't initialize replacement plug-in";
278 return false;
279 }
280 container->setPlugin(replacement_plugin);
281 return true;
274 } 282 }
275 283
276 delegate_ = plugin_delegate; 284 delegate_ = plugin_delegate;
277 285
278 return true; 286 return true;
279 } 287 }
280 288
281 void WebPluginImpl::destroy() { 289 void WebPluginImpl::destroy() {
282 SetContainer(NULL); 290 SetContainer(NULL);
283 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 291 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 webframe_->setReferrerForRequest(*request, plugin_url_); 1430 webframe_->setReferrerForRequest(*request, plugin_url_);
1423 break; 1431 break;
1424 1432
1425 default: 1433 default:
1426 break; 1434 break;
1427 } 1435 }
1428 } 1436 }
1429 1437
1430 } // namespace npapi 1438 } // namespace npapi
1431 } // namespace webkit 1439 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698