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