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

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

Issue 7624048: Revert 97285 - Disable NaCl on 32-bit linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 using WebKit::WebPluginParams; 91 using WebKit::WebPluginParams;
92 using WebKit::WebSecurityPolicy; 92 using WebKit::WebSecurityPolicy;
93 using WebKit::WebString; 93 using WebKit::WebString;
94 using WebKit::WebURLError; 94 using WebKit::WebURLError;
95 using WebKit::WebURLRequest; 95 using WebKit::WebURLRequest;
96 using WebKit::WebURLResponse; 96 using WebKit::WebURLResponse;
97 using WebKit::WebVector; 97 using WebKit::WebVector;
98 98
99 namespace { 99 namespace {
100 100
101 const char* kNaClPluginMimeType = "application/x-nacl";
102 const char* kNaClPluginManifestAttribute = "nacl";
103
101 // Constants for UMA statistic collection. 104 // Constants for UMA statistic collection.
102 static const char kPluginTypeMismatch[] = "Plugin.PluginTypeMismatch"; 105 static const char kPluginTypeMismatch[] = "Plugin.PluginTypeMismatch";
103 static const char kApplicationOctetStream[] = "application/octet-stream"; 106 static const char kApplicationOctetStream[] = "application/octet-stream";
104 enum { 107 enum {
105 PLUGIN_TYPE_MISMATCH_NONE = 0, 108 PLUGIN_TYPE_MISMATCH_NONE = 0,
106 PLUGIN_TYPE_MISMATCH_ORIG_EMPTY, 109 PLUGIN_TYPE_MISMATCH_ORIG_EMPTY,
107 PLUGIN_TYPE_MISMATCH_ORIG_OCTETSTREAM, 110 PLUGIN_TYPE_MISMATCH_ORIG_OCTETSTREAM,
108 PLUGIN_TYPE_MISMATCH_ORIG_OTHER, 111 PLUGIN_TYPE_MISMATCH_ORIG_OTHER,
109 PLUGIN_TYPE_MISMATCH_NUM_EVENTS, 112 PLUGIN_TYPE_MISMATCH_NUM_EVENTS,
110 }; 113 };
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Delay loading plugins if prerendering. 393 // Delay loading plugins if prerendering.
391 if (prerender::PrerenderHelper::IsPrerendering(render_view)) { 394 if (prerender::PrerenderHelper::IsPrerendering(render_view)) {
392 return CreatePluginPlaceholder( 395 return CreatePluginPlaceholder(
393 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML, 396 render_view, frame, params, *group, IDR_CLICK_TO_PLAY_PLUGIN_HTML,
394 IDS_PLUGIN_LOAD, true, true); 397 IDS_PLUGIN_LOAD, true, true);
395 } 398 }
396 399
397 // Enforce Chrome WebStore restriction on the Native Client plugin. 400 // Enforce Chrome WebStore restriction on the Native Client plugin.
398 if (info.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName)) { 401 if (info.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName)) {
399 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl); 402 bool allow_nacl = cmd->HasSwitch(switches::kEnableNaCl);
400 // TODO(elijahtaylor) Remove this #if when crbug.com/92964 is fixed.
401 #if !(defined(OS_LINUX) && ARCH_CPU_32_BITS)
402 if (!allow_nacl) { 403 if (!allow_nacl) {
403 const char* kNaClPluginMimeType = "application/x-nacl";
404 const char* kNaClPluginManifestAttribute = "nacl";
405
406 GURL nexe_url; 404 GURL nexe_url;
407 if (actual_mime_type == kNaClPluginMimeType) { 405 if (actual_mime_type == kNaClPluginMimeType) {
408 nexe_url = url; // Normal embedded NaCl plugin. 406 nexe_url = url; // Normal embedded NaCl plugin.
409 } else { 407 } else {
410 // Content type handling NaCl plugin; the "nacl" param on the 408 // Content type handling NaCl plugin; the "nacl" param on the
411 // MIME type holds the nexe URL. 409 // MIME type holds the nexe URL.
412 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); 410 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute);
413 for (size_t i = 0; i < info.mime_types.size(); ++i) { 411 for (size_t i = 0; i < info.mime_types.size(); ++i) {
414 if (info.mime_types[i].mime_type == actual_mime_type) { 412 if (info.mime_types[i].mime_type == actual_mime_type) {
415 const webkit::WebPluginMimeType& content_type = 413 const webkit::WebPluginMimeType& content_type =
(...skipping 13 matching lines...) Expand all
429 // Create the NaCl plugin only if the .nexe is part of an extension 427 // Create the NaCl plugin only if the .nexe is part of an extension
430 // that was installed from the Chrome Web Store, or part of a component 428 // that was installed from the Chrome Web Store, or part of a component
431 // extension, or part of an unpacked extension. 429 // extension, or part of an unpacked extension.
432 const Extension* extension = 430 const Extension* extension =
433 extension_dispatcher_->extensions()->GetByURL(nexe_url); 431 extension_dispatcher_->extensions()->GetByURL(nexe_url);
434 allow_nacl = extension && 432 allow_nacl = extension &&
435 (extension->from_webstore() || 433 (extension->from_webstore() ||
436 extension->location() == Extension::COMPONENT || 434 extension->location() == Extension::COMPONENT ||
437 extension->location() == Extension::LOAD); 435 extension->location() == Extension::LOAD);
438 } 436 }
439 #endif // !(Linux 32-bit)
440 437
441 if (!allow_nacl) { 438 if (!allow_nacl) {
442 // TODO(bbudge) Webkit will crash if this is a full-frame plug-in and 439 // TODO(bbudge) Webkit will crash if this is a full-frame plug-in and
443 // we return NULL. Prepare a patch to fix that, and return NULL here. 440 // we return NULL. Prepare a patch to fix that, and return NULL here.
444 return CreatePluginPlaceholder( 441 return CreatePluginPlaceholder(
445 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML, 442 render_view, frame, params, *group, IDR_BLOCKED_PLUGIN_HTML,
446 IDS_PLUGIN_BLOCKED, false, false); 443 IDS_PLUGIN_BLOCKED, false, false);
447 } 444 }
448 } 445 }
449 446
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 if (spellcheck_.get()) 714 if (spellcheck_.get())
718 thread->RemoveObserver(spellcheck_.get()); 715 thread->RemoveObserver(spellcheck_.get());
719 SpellCheck* new_spellcheck = new SpellCheck(); 716 SpellCheck* new_spellcheck = new SpellCheck();
720 if (spellcheck_provider_) 717 if (spellcheck_provider_)
721 spellcheck_provider_->SetSpellCheck(new_spellcheck); 718 spellcheck_provider_->SetSpellCheck(new_spellcheck);
722 spellcheck_.reset(new_spellcheck); 719 spellcheck_.reset(new_spellcheck);
723 thread->AddObserver(new_spellcheck); 720 thread->AddObserver(new_spellcheck);
724 } 721 }
725 722
726 } // namespace chrome 723 } // 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