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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 7990005: Use a placeholder instead of the default plugin for missing plug-ins on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() { 260 SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() {
261 return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_SAD_PLUGIN); 261 return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_SAD_PLUGIN);
262 } 262 }
263 263
264 std::string ChromeContentRendererClient::GetDefaultEncoding() { 264 std::string ChromeContentRendererClient::GetDefaultEncoding() {
265 return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING); 265 return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING);
266 } 266 }
267 267
268 bool ChromeContentRendererClient::OverrideCreatePlugin( 268 bool ChromeContentRendererClient::OverrideCreatePlugin(
269 RenderView* render_view, 269 RenderView* render_view,
270 WebFrame* frame, 270 WebFrame* frame,
271 const WebPluginParams& params, 271 const WebPluginParams& params,
272 WebKit::WebPlugin** plugin) { 272 WebKit::WebPlugin** plugin) {
273 bool is_default_plugin; 273 *plugin = CreatePlugin(render_view, frame, params);
274 *plugin = CreatePlugin(render_view, frame, params, &is_default_plugin);
275 if (!*plugin || is_default_plugin)
276 MissingPluginReporter::GetInstance()->ReportPluginMissing(
277 params.mimeType.utf8(), params.url);
278 return true; 274 return true;
279 } 275 }
280 276
281 WebPlugin* ChromeContentRendererClient::CreatePlugin( 277 WebPlugin* ChromeContentRendererClient::CreatePlugin(
282 RenderView* render_view, 278 RenderView* render_view,
283 WebFrame* frame, 279 WebFrame* frame,
284 const WebPluginParams& original_params, 280 const WebPluginParams& original_params) {
285 bool* is_default_plugin) {
286 *is_default_plugin = false;
287 CommandLine* cmd = CommandLine::ForCurrentProcess(); 281 CommandLine* cmd = CommandLine::ForCurrentProcess();
288 webkit::WebPluginInfo info;
289 GURL url(original_params.url); 282 GURL url(original_params.url);
290 std::string orig_mime_type = original_params.mimeType.utf8(); 283 std::string orig_mime_type = original_params.mimeType.utf8();
291 std::string actual_mime_type; 284 ChromeViewHostMsg_GetPluginInfo_Params plugin_params;
285 render_view->Send(new ChromeViewHostMsg_GetPluginInfo(
286 render_view->routing_id(), url, frame->top()->document().url(),
287 orig_mime_type, &plugin_params));
292 288
293 bool found = render_view->GetPluginInfo( 289 if (plugin_params.status ==
294 url, frame->top()->document().url(), orig_mime_type, &info, 290 ChromeViewHostMsg_GetPluginInfo_Status::kNotFound) {
295 &actual_mime_type); 291 MissingPluginReporter::GetInstance()->ReportPluginMissing(
292 orig_mime_type, url);
293 return CreatePluginPlaceholder(
294 render_view, frame, original_params, NULL, IDR_BLOCKED_PLUGIN_HTML,
295 IDS_PLUGIN_NOT_FOUND, false, false);
296 } else if (plugin_params.status ==
297 ChromeViewHostMsg_GetPluginInfo_Status::kDisabled) {
298 return NULL; // TODO(bauerb): Show a placeholder for a disabled plug-in.
299 }
296 300
297 if (!found) 301 if (plugin_params.plugin.path.value() ==
298 return NULL; 302 webkit::npapi::kDefaultPluginLibraryName) {
303 MissingPluginReporter::GetInstance()->ReportPluginMissing(
304 orig_mime_type, url);
305 }
299 306
300 *is_default_plugin = 307 if (orig_mime_type == plugin_params.actual_mime_type) {
301 info.path.value() == webkit::npapi::kDefaultPluginLibraryName;
302
303 if (orig_mime_type == actual_mime_type) {
304 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, 308 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch,
305 PLUGIN_TYPE_MISMATCH_NONE, 309 PLUGIN_TYPE_MISMATCH_NONE,
306 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); 310 PLUGIN_TYPE_MISMATCH_NUM_EVENTS);
307 } else if (orig_mime_type.empty()) { 311 } else if (orig_mime_type.empty()) {
308 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, 312 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch,
309 PLUGIN_TYPE_MISMATCH_ORIG_EMPTY, 313 PLUGIN_TYPE_MISMATCH_ORIG_EMPTY,
310 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); 314 PLUGIN_TYPE_MISMATCH_NUM_EVENTS);
311 } else if (orig_mime_type == kApplicationOctetStream) { 315 } else if (orig_mime_type == kApplicationOctetStream) {
312 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, 316 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch,
313 PLUGIN_TYPE_MISMATCH_ORIG_OCTETSTREAM, 317 PLUGIN_TYPE_MISMATCH_ORIG_OCTETSTREAM,
314 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); 318 PLUGIN_TYPE_MISMATCH_NUM_EVENTS);
315 } else { 319 } else {
316 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, 320 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch,
317 PLUGIN_TYPE_MISMATCH_ORIG_OTHER, 321 PLUGIN_TYPE_MISMATCH_ORIG_OTHER,
318 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); 322 PLUGIN_TYPE_MISMATCH_NUM_EVENTS);
319 // We do not permit URL-sniff based plug-in MIME type overrides aside from 323 // We do not permit URL-sniff based plug-in MIME type overrides aside from
320 // the case where the "type" was initially missing or generic 324 // the case where the "type" was initially missing or generic
321 // (application/octet-stream). 325 // (application/octet-stream).
322 // We collected stats to determine this approach isn't a major compat issue, 326 // We collected stats to determine this approach isn't a major compat issue,
323 // and we defend against content confusion attacks in various cases, such 327 // and we defend against content confusion attacks in various cases, such
324 // as when the user doesn't have the Flash plug-in enabled. 328 // as when the user doesn't have the Flash plug-in enabled.
325 return NULL; 329 return NULL;
326 } 330 }
327 331
328 scoped_ptr<webkit::npapi::PluginGroup> group( 332 scoped_ptr<webkit::npapi::PluginGroup> group(
329 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info)); 333 webkit::npapi::PluginList::Singleton()->GetPluginGroup(
334 plugin_params.plugin));
330 335
331 ContentSettingsType content_type = CONTENT_SETTINGS_TYPE_PLUGINS; 336 ContentSettingsType content_type = CONTENT_SETTINGS_TYPE_PLUGINS;
332 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; 337 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
333 std::string resource; 338 std::string resource;
334 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) 339 if (cmd->HasSwitch(switches::kEnableResourceContentSettings))
335 resource = group->identifier(); 340 resource = group->identifier();
336 render_view->Send(new ChromeViewHostMsg_GetPluginContentSetting( 341 render_view->Send(new ChromeViewHostMsg_GetPluginContentSetting(
337 frame->top()->document().url(), resource, &plugin_setting)); 342 frame->top()->document().url(), resource, &plugin_setting));
338 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 343 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
339 344
340 WebPluginParams params(original_params); 345 WebPluginParams params(original_params);
341 for (size_t i = 0; i < info.mime_types.size(); ++i) { 346 for (size_t i = 0; i < plugin_params.plugin.mime_types.size(); ++i) {
342 if (info.mime_types[i].mime_type == actual_mime_type) { 347 if (plugin_params.plugin.mime_types[i].mime_type ==
343 AppendParams(info.mime_types[i].additional_param_names, 348 plugin_params.actual_mime_type) {
344 info.mime_types[i].additional_param_values, 349 AppendParams(plugin_params.plugin.mime_types[i].additional_param_names,
350 plugin_params.plugin.mime_types[i].additional_param_values,
345 &params.attributeNames, 351 &params.attributeNames,
346 &params.attributeValues); 352 &params.attributeValues);
347 break; 353 break;
348 } 354 }
349 } 355 }
350 356
351 ContentSetting outdated_policy = CONTENT_SETTING_ASK; 357 ContentSetting outdated_policy = CONTENT_SETTING_ASK;
352 ContentSetting authorize_policy = CONTENT_SETTING_ASK; 358 ContentSetting authorize_policy = CONTENT_SETTING_ASK;
353 if (group->IsVulnerable(info) || group->RequiresAuthorization(info)) { 359 if (group->IsVulnerable(plugin_params.plugin) ||
360 group->RequiresAuthorization(plugin_params.plugin)) {
354 // These policies are dynamic and can changed at runtime, so they aren't 361 // These policies are dynamic and can changed at runtime, so they aren't
355 // cached here. 362 // cached here.
356 render_view->Send(new ChromeViewHostMsg_GetPluginPolicies( 363 render_view->Send(new ChromeViewHostMsg_GetPluginPolicies(
357 &outdated_policy, &authorize_policy)); 364 &outdated_policy, &authorize_policy));
358 } 365 }
359 366
360 if (group->IsVulnerable(info)) { 367 if (group->IsVulnerable(plugin_params.plugin)) {
361 if (outdated_policy == CONTENT_SETTING_ASK || 368 if (outdated_policy == CONTENT_SETTING_ASK ||
362 outdated_policy == CONTENT_SETTING_BLOCK) { 369 outdated_policy == CONTENT_SETTING_BLOCK) {
363 if (outdated_policy == CONTENT_SETTING_ASK) { 370 if (outdated_policy == CONTENT_SETTING_ASK) {
364 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin( 371 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin(
365 render_view->routing_id(), group->GetGroupName(), 372 render_view->routing_id(), group->GetGroupName(),
366 GURL(group->GetUpdateURL()))); 373 GURL(group->GetUpdateURL())));
367 } 374 }
368 return CreatePluginPlaceholder( 375 return CreatePluginPlaceholder(
369 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 376 render_view, frame, params, group.get(), IDR_BLOCKED_PLUGIN_HTML,
370 IDS_PLUGIN_OUTDATED, false, outdated_policy == CONTENT_SETTING_ASK); 377 IDS_PLUGIN_OUTDATED, false, outdated_policy == CONTENT_SETTING_ASK);
371 } else { 378 } else {
372 DCHECK(outdated_policy == CONTENT_SETTING_ALLOW); 379 DCHECK(outdated_policy == CONTENT_SETTING_ALLOW);
373 } 380 }
374 } 381 }
375 382
376 ContentSettingsObserver* observer = ContentSettingsObserver::Get(render_view); 383 ContentSettingsObserver* observer = ContentSettingsObserver::Get(render_view);
377 ContentSetting host_setting = 384 ContentSetting host_setting =
378 observer->GetContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS); 385 observer->GetContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS);
379 386
380 if (group->RequiresAuthorization(info) && 387 if (group->RequiresAuthorization(plugin_params.plugin) &&
381 authorize_policy == CONTENT_SETTING_ASK && 388 authorize_policy == CONTENT_SETTING_ASK &&
382 (plugin_setting == CONTENT_SETTING_ALLOW || 389 (plugin_setting == CONTENT_SETTING_ALLOW ||
383 plugin_setting == CONTENT_SETTING_ASK) && 390 plugin_setting == CONTENT_SETTING_ASK) &&
384 host_setting == CONTENT_SETTING_DEFAULT) { 391 host_setting == CONTENT_SETTING_DEFAULT) {
385 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin( 392 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin(
386 render_view->routing_id(), group->GetGroupName(), GURL())); 393 render_view->routing_id(), group->GetGroupName(), GURL()));
387 return CreatePluginPlaceholder( 394 return CreatePluginPlaceholder(
388 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 395 render_view, frame, params, group.get(), IDR_BLOCKED_PLUGIN_HTML,
389 IDS_PLUGIN_NOT_AUTHORIZED, false, true); 396 IDS_PLUGIN_NOT_AUTHORIZED, false, true);
390 } 397 }
391 398
392 // Treat Native Client invocations like Javascript. 399 // Treat Native Client invocations like Javascript.
393 bool is_nacl_plugin = 400 bool is_nacl_plugin = plugin_params.plugin.name ==
394 info.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName); 401 ASCIIToUTF16(ChromeContentClient::kNaClPluginName);
395 if (is_nacl_plugin) { 402 if (is_nacl_plugin) {
396 content_type = CONTENT_SETTINGS_TYPE_JAVASCRIPT; 403 content_type = CONTENT_SETTINGS_TYPE_JAVASCRIPT;
397 plugin_setting = 404 plugin_setting =
398 observer->GetContentSetting(content_type); 405 observer->GetContentSetting(content_type);
399 } 406 }
400 407
401 if (plugin_setting == CONTENT_SETTING_ALLOW || 408 if (plugin_setting == CONTENT_SETTING_ALLOW ||
402 host_setting == CONTENT_SETTING_ALLOW || 409 host_setting == CONTENT_SETTING_ALLOW ||
403 info.path.value() == webkit::npapi::kDefaultPluginLibraryName) { 410 plugin_params.plugin.path.value() ==
411 webkit::npapi::kDefaultPluginLibraryName) {
404 // Delay loading plugins if prerendering. 412 // Delay loading plugins if prerendering.
405 if (prerender::PrerenderHelper::IsPrerendering(render_view)) { 413 if (prerender::PrerenderHelper::IsPrerendering(render_view)) {
406 return CreatePluginPlaceholder( 414 return CreatePluginPlaceholder(
407 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, 415 render_view, frame, params, group.get(),
408 IDS_PLUGIN_LOAD, true, true); 416 IDR_CLICK_TO_PLAY_PLUGIN_HTML, IDS_PLUGIN_LOAD, true, true);
409 } 417 }
410 418
411 // Enforce the Chrome WebStore restriction on the Native Client plugin. 419 // Enforce the Chrome WebStore restriction on the Native Client plugin.
412 if (is_nacl_plugin) { 420 if (is_nacl_plugin) {
413 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl); 421 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl);
414 if (!allow_nacl) { 422 if (!allow_nacl) {
415 const char* kNaClPluginMimeType = "application/x-nacl"; 423 const char* kNaClPluginMimeType = "application/x-nacl";
416 const char* kNaClPluginManifestAttribute = "nacl"; 424 const char* kNaClPluginManifestAttribute = "nacl";
417 425
418 GURL nexe_url; 426 GURL nexe_url;
419 if (actual_mime_type == kNaClPluginMimeType) { 427 if (plugin_params.actual_mime_type == kNaClPluginMimeType) {
420 nexe_url = url; // Normal embedded NaCl plugin. 428 nexe_url = url; // Normal embedded NaCl plugin.
421 } else { 429 } else {
422 // Content type handling NaCl plugin; the "nacl" param on the 430 // Content type handling NaCl plugin; the "nacl" param on the
423 // MIME type holds the nexe URL. 431 // MIME type holds the nexe URL.
424 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); 432 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute);
425 for (size_t i = 0; i < info.mime_types.size(); ++i) { 433 for (size_t i = 0; i < plugin_params.plugin.mime_types.size(); ++i) {
426 if (info.mime_types[i].mime_type == actual_mime_type) { 434 if (plugin_params.plugin.mime_types[i].mime_type ==
435 plugin_params.actual_mime_type) {
427 const webkit::WebPluginMimeType& content_type = 436 const webkit::WebPluginMimeType& content_type =
428 info.mime_types[i]; 437 plugin_params.plugin.mime_types[i];
429 for (size_t i = 0; 438 for (size_t i = 0;
430 i < content_type.additional_param_names.size(); ++i) { 439 i < content_type.additional_param_names.size(); ++i) {
431 if (content_type.additional_param_names[i] == nacl_attr) { 440 if (content_type.additional_param_names[i] == nacl_attr) {
432 nexe_url = GURL(content_type.additional_param_values[i]); 441 nexe_url = GURL(content_type.additional_param_values[i]);
433 break; 442 break;
434 } 443 }
435 } 444 }
436 break; 445 break;
437 } 446 }
438 } 447 }
439 } 448 }
440 449
441 // Create the NaCl plugin only if the .nexe is part of an extension 450 // Create the NaCl plugin only if the .nexe is part of an extension
442 // that was installed from the Chrome Web Store, or part of a component 451 // that was installed from the Chrome Web Store, or part of a component
443 // extension, or part of an unpacked extension. 452 // extension, or part of an unpacked extension.
444 const Extension* extension = 453 const Extension* extension =
445 extension_dispatcher_->extensions()->GetByURL(nexe_url); 454 extension_dispatcher_->extensions()->GetByURL(nexe_url);
446 allow_nacl = extension && 455 allow_nacl = extension &&
447 (extension->from_webstore() || 456 (extension->from_webstore() ||
448 extension->location() == Extension::COMPONENT || 457 extension->location() == Extension::COMPONENT ||
449 extension->location() == Extension::LOAD); 458 extension->location() == Extension::LOAD);
450 } 459 }
451 460
452 if (!allow_nacl) { 461 if (!allow_nacl) {
453 // TODO(bbudge) Webkit will crash if this is a full-frame plug-in and 462 // TODO(bbudge) Webkit will crash if this is a full-frame plug-in and
454 // we return NULL. Prepare a patch to fix that, and return NULL here. 463 // we return NULL. Prepare a patch to fix that, and return NULL here.
455 return CreatePluginPlaceholder( 464 return CreatePluginPlaceholder(
456 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 465 render_view, frame, params, group.get(), IDR_BLOCKED_PLUGIN_HTML,
457 IDS_PLUGIN_BLOCKED, false, false); 466 IDS_PLUGIN_BLOCKED, false, false);
458 } 467 }
459 } 468 }
460 469
461 bool pepper_plugin_was_registered = false; 470 bool pepper_plugin_was_registered = false;
462 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 471 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
463 render_view->pepper_delegate()->CreatePepperPluginModule( 472 render_view->pepper_delegate()->CreatePepperPluginModule(
464 info, &pepper_plugin_was_registered)); 473 plugin_params.plugin, &pepper_plugin_was_registered));
465 if (pepper_plugin_was_registered) { 474 if (pepper_plugin_was_registered) {
466 if (pepper_module) { 475 if (pepper_module) {
467 return render_view->CreatePepperPlugin( 476 return render_view->CreatePepperPlugin(
468 frame, params, info.path, pepper_module.get()); 477 frame, params, plugin_params.plugin.path, pepper_module.get());
469 } 478 }
470 return NULL; 479 return NULL;
471 } 480 }
472 481
473 return render_view->CreateNPAPIPlugin( 482 return render_view->CreateNPAPIPlugin(
474 frame, params, info.path, actual_mime_type); 483 frame, params, plugin_params.plugin.path,
484 plugin_params.actual_mime_type);
475 } 485 }
476 486
477 observer->DidBlockContentType(content_type, resource); 487 observer->DidBlockContentType(content_type, resource);
478 if (plugin_setting == CONTENT_SETTING_ASK) { 488 if (plugin_setting == CONTENT_SETTING_ASK) {
479 RenderThread::RecordUserMetrics("Plugin_ClickToPlay"); 489 RenderThread::RecordUserMetrics("Plugin_ClickToPlay");
480 return CreatePluginPlaceholder( 490 return CreatePluginPlaceholder(
481 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, 491 render_view, frame, params, group.get(), IDR_CLICK_TO_PLAY_PLUGIN_HTML,
482 IDS_PLUGIN_LOAD, false, true); 492 IDS_PLUGIN_LOAD, false, true);
483 } else { 493 } else {
484 RenderThread::RecordUserMetrics("Plugin_Blocked"); 494 RenderThread::RecordUserMetrics("Plugin_Blocked");
485 return CreatePluginPlaceholder( 495 return CreatePluginPlaceholder(
486 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 496 render_view, frame, params, group.get(), IDR_BLOCKED_PLUGIN_HTML,
487 IDS_PLUGIN_BLOCKED, false, true); 497 IDS_PLUGIN_BLOCKED, false, true);
488 } 498 }
489 } 499 }
490 500
491 WebPlugin* ChromeContentRendererClient::CreatePluginPlaceholder( 501 WebPlugin* ChromeContentRendererClient::CreatePluginPlaceholder(
492 RenderView* render_view, 502 RenderView* render_view,
493 WebFrame* frame, 503 WebFrame* frame,
494 const WebPluginParams& params, 504 const WebPluginParams& params,
495 const webkit::npapi::PluginGroup& group, 505 const webkit::npapi::PluginGroup* group,
496 int resource_id, 506 int resource_id,
497 int message_id, 507 int message_id,
498 bool is_blocked_for_prerendering, 508 bool is_blocked_for_prerendering,
499 bool allow_loading) { 509 bool allow_loading) {
500 // |blocked_plugin| will delete itself when the WebViewPlugin 510 // |blocked_plugin| will delete itself when the WebViewPlugin
501 // is destroyed. 511 // is destroyed.
512 string16 name;
513 string16 message;
514 if (group) {
515 name = group->GetGroupName();
516 message = l10n_util::GetStringFUTF16(message_id, name);
517 } else {
518 message = l10n_util::GetStringUTF16(message_id);
519 }
520
502 BlockedPlugin* blocked_plugin = 521 BlockedPlugin* blocked_plugin =
503 new BlockedPlugin(render_view, 522 new BlockedPlugin(render_view,
504 frame, 523 frame,
505 group,
506 params, 524 params,
507 render_view->webkit_preferences(), 525 render_view->webkit_preferences(),
508 resource_id, 526 resource_id,
509 l10n_util::GetStringFUTF16(message_id, 527 name,
510 group.GetGroupName()), 528 message,
511 is_blocked_for_prerendering, 529 is_blocked_for_prerendering,
512 allow_loading); 530 allow_loading);
513 return blocked_plugin->plugin(); 531 return blocked_plugin->plugin();
514 } 532 }
515 533
516 void ChromeContentRendererClient::ShowErrorPage(RenderView* render_view, 534 void ChromeContentRendererClient::ShowErrorPage(RenderView* render_view,
517 WebKit::WebFrame* frame, 535 WebKit::WebFrame* frame,
518 int http_status_code) { 536 int http_status_code) {
519 // Use an internal error page, if we have one for the status code. 537 // Use an internal error page, if we have one for the status code.
520 if (LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, 538 if (LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 return true; 727 return true;
710 } 728 }
711 return false; 729 return false;
712 } 730 }
713 731
714 bool ChromeContentRendererClient::IsProtocolSupportedForMedia( 732 bool ChromeContentRendererClient::IsProtocolSupportedForMedia(
715 const GURL& url) { 733 const GURL& url) {
716 return url.SchemeIs(chrome::kExtensionScheme); 734 return url.SchemeIs(chrome::kExtensionScheme);
717 } 735 }
718 736
719
720 void ChromeContentRendererClient::SetExtensionDispatcher( 737 void ChromeContentRendererClient::SetExtensionDispatcher(
721 ExtensionDispatcher* extension_dispatcher) { 738 ExtensionDispatcher* extension_dispatcher) {
722 extension_dispatcher_.reset(extension_dispatcher); 739 extension_dispatcher_.reset(extension_dispatcher);
723 } 740 }
724 741
725 bool ChromeContentRendererClient::CrossesExtensionExtents( 742 bool ChromeContentRendererClient::CrossesExtensionExtents(
726 WebFrame* frame, 743 WebFrame* frame,
727 const GURL& new_url, 744 const GURL& new_url,
728 bool is_initial_navigation) { 745 bool is_initial_navigation) {
729 const ExtensionSet* extensions = extension_dispatcher_->extensions(); 746 const ExtensionSet* extensions = extension_dispatcher_->extensions();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (spellcheck_.get()) 786 if (spellcheck_.get())
770 thread->RemoveObserver(spellcheck_.get()); 787 thread->RemoveObserver(spellcheck_.get());
771 SpellCheck* new_spellcheck = new SpellCheck(); 788 SpellCheck* new_spellcheck = new SpellCheck();
772 if (spellcheck_provider_) 789 if (spellcheck_provider_)
773 spellcheck_provider_->SetSpellCheck(new_spellcheck); 790 spellcheck_provider_->SetSpellCheck(new_spellcheck);
774 spellcheck_.reset(new_spellcheck); 791 spellcheck_.reset(new_spellcheck);
775 thread->AddObserver(new_spellcheck); 792 thread->AddObserver(new_spellcheck);
776 } 793 }
777 794
778 } // namespace chrome 795 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698