| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (!found) | 260 if (!found) |
| 261 return NULL; | 261 return NULL; |
| 262 if (!webkit::npapi::IsPluginEnabled(info)) | 262 if (!webkit::npapi::IsPluginEnabled(info)) |
| 263 return NULL; | 263 return NULL; |
| 264 | 264 |
| 265 const webkit::npapi::PluginGroup* group = | 265 const webkit::npapi::PluginGroup* group = |
| 266 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info); | 266 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info); |
| 267 DCHECK(group != NULL); | 267 DCHECK(group != NULL); |
| 268 | 268 |
| 269 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; | 269 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; |
| 270 std::string resource = group->identifier(); | 270 std::string resource; |
| 271 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
| 272 resource = group->identifier(); |
| 271 render_view->Send(new ViewHostMsg_GetPluginContentSetting( | 273 render_view->Send(new ViewHostMsg_GetPluginContentSetting( |
| 272 frame->top()->url(), resource, &plugin_setting)); | 274 frame->top()->url(), resource, &plugin_setting)); |
| 273 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); | 275 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); |
| 274 | 276 |
| 275 WebPluginParams params(original_params); | 277 WebPluginParams params(original_params); |
| 276 for (size_t i = 0; i < info.mime_types.size(); ++i) { | 278 for (size_t i = 0; i < info.mime_types.size(); ++i) { |
| 277 if (info.mime_types[i].mime_type == actual_mime_type) { | 279 if (info.mime_types[i].mime_type == actual_mime_type) { |
| 278 AppendParams(info.mime_types[i].additional_param_names, | 280 AppendParams(info.mime_types[i].additional_param_names, |
| 279 info.mime_types[i].additional_param_values, | 281 info.mime_types[i].additional_param_values, |
| 280 ¶ms.attributeNames, | 282 ¶ms.attributeNames, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return render_view->CreatePepperPlugin( | 345 return render_view->CreatePepperPlugin( |
| 344 frame, params, info.path, pepper_module.get()); | 346 frame, params, info.path, pepper_module.get()); |
| 345 } | 347 } |
| 346 return NULL; | 348 return NULL; |
| 347 } | 349 } |
| 348 | 350 |
| 349 return render_view->CreateNPAPIPlugin( | 351 return render_view->CreateNPAPIPlugin( |
| 350 frame, params, info.path, actual_mime_type); | 352 frame, params, info.path, actual_mime_type); |
| 351 } | 353 } |
| 352 | 354 |
| 353 observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, | 355 observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); |
| 354 cmd->HasSwitch(switches::kEnableResourceContentSettings) ? | |
| 355 resource : std::string()); | |
| 356 if (plugin_setting == CONTENT_SETTING_ASK) { | 356 if (plugin_setting == CONTENT_SETTING_ASK) { |
| 357 return CreatePluginPlaceholder( | 357 return CreatePluginPlaceholder( |
| 358 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, | 358 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, |
| 359 IDS_PLUGIN_LOAD, false, true); | 359 IDS_PLUGIN_LOAD, false, true); |
| 360 } else { | 360 } else { |
| 361 return CreatePluginPlaceholder( | 361 return CreatePluginPlaceholder( |
| 362 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, | 362 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, |
| 363 IDS_PLUGIN_BLOCKED, false, true); | 363 IDS_PLUGIN_BLOCKED, false, true); |
| 364 } | 364 } |
| 365 } | 365 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (old_url == new_url) { | 574 if (old_url == new_url) { |
| 575 bool is_extension_url = !!extensions->GetByURL(new_url); | 575 bool is_extension_url = !!extensions->GetByURL(new_url); |
| 576 if (is_extension_url != extension_dispatcher_->is_extension_process()) | 576 if (is_extension_url != extension_dispatcher_->is_extension_process()) |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 | 579 |
| 580 return !extensions->InSameExtent(old_url, new_url); | 580 return !extensions->InSameExtent(old_url, new_url); |
| 581 } | 581 } |
| 582 | 582 |
| 583 } // namespace chrome | 583 } // namespace chrome |
| OLD | NEW |