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

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

Issue 7978037: Don't block the Native Client plug-in when plug-ins are blocked by content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 (plugin_setting == CONTENT_SETTING_ALLOW || 384 (plugin_setting == CONTENT_SETTING_ALLOW ||
385 plugin_setting == CONTENT_SETTING_ASK) && 385 plugin_setting == CONTENT_SETTING_ASK) &&
386 host_setting == CONTENT_SETTING_DEFAULT) { 386 host_setting == CONTENT_SETTING_DEFAULT) {
387 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin( 387 render_view->Send(new ChromeViewHostMsg_BlockedOutdatedPlugin(
388 render_view->routing_id(), group->GetGroupName(), GURL())); 388 render_view->routing_id(), group->GetGroupName(), GURL()));
389 return CreatePluginPlaceholder( 389 return CreatePluginPlaceholder(
390 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 390 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML,
391 IDS_PLUGIN_NOT_AUTHORIZED, false, true); 391 IDS_PLUGIN_NOT_AUTHORIZED, false, true);
392 } 392 }
393 393
394 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName || 394 // Treat Native Client invocations like Javascript.
395 plugin_setting == CONTENT_SETTING_ALLOW || 395 bool is_nacl_plugin =
396 host_setting == CONTENT_SETTING_ALLOW) { 396 info.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName);
397 if (is_nacl_plugin) {
398 plugin_setting =
399 observer->GetContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT);
400 }
401
402 if (plugin_setting == CONTENT_SETTING_ALLOW ||
403 host_setting == CONTENT_SETTING_ALLOW ||
404 info.path.value() == webkit::npapi::kDefaultPluginLibraryName) {
Bernhard Bauer 2011/09/23 08:26:08 Uh, if NaCl is blocked here, we will show the bloc
397 // Delay loading plugins if prerendering. 405 // Delay loading plugins if prerendering.
398 if (prerender::PrerenderHelper::IsPrerendering(render_view)) { 406 if (prerender::PrerenderHelper::IsPrerendering(render_view)) {
399 return CreatePluginPlaceholder( 407 return CreatePluginPlaceholder(
400 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, 408 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML,
401 IDS_PLUGIN_LOAD, true, true); 409 IDS_PLUGIN_LOAD, true, true);
402 } 410 }
403 411
404 // Enforce Chrome WebStore restriction on the Native Client plugin. 412 // Enforce the Chrome WebStore restriction on the Native Client plugin.
405 if (info.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName)) { 413 if (is_nacl_plugin) {
406 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl); 414 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl);
407 if (!allow_nacl) { 415 if (!allow_nacl) {
408 const char* kNaClPluginMimeType = "application/x-nacl"; 416 const char* kNaClPluginMimeType = "application/x-nacl";
409 const char* kNaClPluginManifestAttribute = "nacl"; 417 const char* kNaClPluginManifestAttribute = "nacl";
410 418
411 GURL nexe_url; 419 GURL nexe_url;
412 if (actual_mime_type == kNaClPluginMimeType) { 420 if (actual_mime_type == kNaClPluginMimeType) {
413 nexe_url = url; // Normal embedded NaCl plugin. 421 nexe_url = url; // Normal embedded NaCl plugin.
414 } else { 422 } else {
415 // Content type handling NaCl plugin; the "nacl" param on the 423 // Content type handling NaCl plugin; the "nacl" param on the
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 if (spellcheck_.get()) 772 if (spellcheck_.get())
765 thread->RemoveObserver(spellcheck_.get()); 773 thread->RemoveObserver(spellcheck_.get());
766 SpellCheck* new_spellcheck = new SpellCheck(); 774 SpellCheck* new_spellcheck = new SpellCheck();
767 if (spellcheck_provider_) 775 if (spellcheck_provider_)
768 spellcheck_provider_->SetSpellCheck(new_spellcheck); 776 spellcheck_provider_->SetSpellCheck(new_spellcheck);
769 spellcheck_.reset(new_spellcheck); 777 spellcheck_.reset(new_spellcheck);
770 thread->AddObserver(new_spellcheck); 778 thread->AddObserver(new_spellcheck);
771 } 779 }
772 780
773 } // namespace chrome 781 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698