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