| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 const webkit::npapi::PluginGroup* group = | 326 const webkit::npapi::PluginGroup* group = |
| 327 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info); | 327 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info); |
| 328 DCHECK(group != NULL); | 328 DCHECK(group != NULL); |
| 329 | 329 |
| 330 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; | 330 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; |
| 331 std::string resource; | 331 std::string resource; |
| 332 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 332 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
| 333 resource = group->identifier(); | 333 resource = group->identifier(); |
| 334 render_view->Send(new ViewHostMsg_GetPluginContentSetting( | 334 render_view->Send(new ChromeViewHostMsg_GetPluginContentSetting( |
| 335 frame->top()->document().url(), resource, &plugin_setting)); | 335 frame->top()->document().url(), resource, &plugin_setting)); |
| 336 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); | 336 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); |
| 337 | 337 |
| 338 WebPluginParams params(original_params); | 338 WebPluginParams params(original_params); |
| 339 for (size_t i = 0; i < info.mime_types.size(); ++i) { | 339 for (size_t i = 0; i < info.mime_types.size(); ++i) { |
| 340 if (info.mime_types[i].mime_type == actual_mime_type) { | 340 if (info.mime_types[i].mime_type == actual_mime_type) { |
| 341 AppendParams(info.mime_types[i].additional_param_names, | 341 AppendParams(info.mime_types[i].additional_param_names, |
| 342 info.mime_types[i].additional_param_values, | 342 info.mime_types[i].additional_param_values, |
| 343 ¶ms.attributeNames, | 343 ¶ms.attributeNames, |
| 344 ¶ms.attributeValues); | 344 ¶ms.attributeValues); |
| 345 break; | 345 break; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 | 348 |
| 349 ContentSetting outdated_policy = CONTENT_SETTING_ASK; | 349 ContentSetting outdated_policy = CONTENT_SETTING_ASK; |
| 350 ContentSetting authorize_policy = CONTENT_SETTING_ASK; | 350 ContentSetting authorize_policy = CONTENT_SETTING_ASK; |
| 351 if (group->IsVulnerable() || group->RequiresAuthorization()) { | 351 if (group->IsVulnerable() || group->RequiresAuthorization()) { |
| 352 // These policies are dynamic and can changed at runtime, so they aren't | 352 // These policies are dynamic and can changed at runtime, so they aren't |
| 353 // cached here. | 353 // cached here. |
| 354 render_view->Send(new ViewHostMsg_GetPluginPolicies( | 354 render_view->Send(new ChromeViewHostMsg_GetPluginPolicies( |
| 355 &outdated_policy, &authorize_policy)); | 355 &outdated_policy, &authorize_policy)); |
| 356 } | 356 } |
| 357 | 357 |
| 358 if (group->IsVulnerable()) { | 358 if (group->IsVulnerable()) { |
| 359 if (outdated_policy == CONTENT_SETTING_ASK || | 359 if (outdated_policy == CONTENT_SETTING_ASK || |
| 360 outdated_policy == CONTENT_SETTING_BLOCK) { | 360 outdated_policy == CONTENT_SETTING_BLOCK) { |
| 361 if (outdated_policy == CONTENT_SETTING_ASK) { | 361 if (outdated_policy == CONTENT_SETTING_ASK) { |
| 362 render_view->Send(new ViewHostMsg_BlockedOutdatedPlugin( | 362 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin( |
| 363 render_view->routing_id(), group->GetGroupName(), | 363 render_view->routing_id(), group->GetGroupName(), |
| 364 GURL(group->GetUpdateURL()))); | 364 GURL(group->GetUpdateURL()))); |
| 365 } | 365 } |
| 366 return CreatePluginPlaceholder( | 366 return CreatePluginPlaceholder( |
| 367 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, | 367 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, |
| 368 IDS_PLUGIN_OUTDATED, false, outdated_policy == CONTENT_SETTING_ASK); | 368 IDS_PLUGIN_OUTDATED, false, outdated_policy == CONTENT_SETTING_ASK); |
| 369 } else { | 369 } else { |
| 370 DCHECK(outdated_policy == CONTENT_SETTING_ALLOW); | 370 DCHECK(outdated_policy == CONTENT_SETTING_ALLOW); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 ContentSettingsObserver* observer = ContentSettingsObserver::Get(render_view); | 374 ContentSettingsObserver* observer = ContentSettingsObserver::Get(render_view); |
| 375 ContentSetting host_setting = | 375 ContentSetting host_setting = |
| 376 observer->GetContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS); | 376 observer->GetContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS); |
| 377 | 377 |
| 378 if (group->RequiresAuthorization() && | 378 if (group->RequiresAuthorization() && |
| 379 authorize_policy == CONTENT_SETTING_ASK && | 379 authorize_policy == CONTENT_SETTING_ASK && |
| 380 (plugin_setting == CONTENT_SETTING_ALLOW || | 380 (plugin_setting == CONTENT_SETTING_ALLOW || |
| 381 plugin_setting == CONTENT_SETTING_ASK) && | 381 plugin_setting == CONTENT_SETTING_ASK) && |
| 382 host_setting == CONTENT_SETTING_DEFAULT) { | 382 host_setting == CONTENT_SETTING_DEFAULT) { |
| 383 render_view->Send(new ViewHostMsg_BlockedOutdatedPlugin( | 383 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin( |
| 384 render_view->routing_id(), group->GetGroupName(), GURL())); | 384 render_view->routing_id(), group->GetGroupName(), GURL())); |
| 385 return CreatePluginPlaceholder( | 385 return CreatePluginPlaceholder( |
| 386 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, | 386 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, |
| 387 IDS_PLUGIN_NOT_AUTHORIZED, false, true); | 387 IDS_PLUGIN_NOT_AUTHORIZED, false, true); |
| 388 } | 388 } |
| 389 | 389 |
| 390 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName || | 390 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName || |
| 391 plugin_setting == CONTENT_SETTING_ALLOW || | 391 plugin_setting == CONTENT_SETTING_ALLOW || |
| 392 host_setting == CONTENT_SETTING_ALLOW) { | 392 host_setting == CONTENT_SETTING_ALLOW) { |
| 393 // Delay loading plugins if prerendering. | 393 // Delay loading plugins if prerendering. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 if (spellcheck_.get()) | 736 if (spellcheck_.get()) |
| 737 thread->RemoveObserver(spellcheck_.get()); | 737 thread->RemoveObserver(spellcheck_.get()); |
| 738 SpellCheck* new_spellcheck = new SpellCheck(); | 738 SpellCheck* new_spellcheck = new SpellCheck(); |
| 739 if (spellcheck_provider_) | 739 if (spellcheck_provider_) |
| 740 spellcheck_provider_->SetSpellCheck(new_spellcheck); | 740 spellcheck_provider_->SetSpellCheck(new_spellcheck); |
| 741 spellcheck_.reset(new_spellcheck); | 741 spellcheck_.reset(new_spellcheck); |
| 742 thread->AddObserver(new_spellcheck); | 742 thread->AddObserver(new_spellcheck); |
| 743 } | 743 } |
| 744 | 744 |
| 745 } // namespace chrome | 745 } // namespace chrome |
| OLD | NEW |