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

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

Issue 437503004: Add NaCl support to app_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (nacl-init) rebase Created 6 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 | « chrome/renderer/DEPS ('k') | components/nacl.gyp » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/user_metrics_action.h" 12 #include "base/metrics/user_metrics_action.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/common/chrome_content_client.h"
19 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
22 #include "chrome/common/content_settings_pattern.h" 21 #include "chrome/common/content_settings_pattern.h"
23 #include "chrome/common/crash_keys.h" 22 #include "chrome/common/crash_keys.h"
24 #include "chrome/common/extensions/chrome_extensions_client.h" 23 #include "chrome/common/extensions/chrome_extensions_client.h"
25 #include "chrome/common/extensions/extension_constants.h" 24 #include "chrome/common/extensions/extension_constants.h"
26 #include "chrome/common/extensions/extension_process_policy.h" 25 #include "chrome/common/extensions/extension_process_policy.h"
27 #include "chrome/common/localized_error.h" 26 #include "chrome/common/localized_error.h"
28 #include "chrome/common/pepper_permission_util.h" 27 #include "chrome/common/pepper_permission_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "third_party/WebKit/public/web/WebPluginParams.h" 107 #include "third_party/WebKit/public/web/WebPluginParams.h"
109 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 108 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
110 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 109 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
111 #include "ui/base/l10n/l10n_util.h" 110 #include "ui/base/l10n/l10n_util.h"
112 #include "ui/base/layout.h" 111 #include "ui/base/layout.h"
113 #include "ui/base/resource/resource_bundle.h" 112 #include "ui/base/resource/resource_bundle.h"
114 #include "ui/base/webui/jstemplate_builder.h" 113 #include "ui/base/webui/jstemplate_builder.h"
115 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 114 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
116 115
117 #if !defined(DISABLE_NACL) 116 #if !defined(DISABLE_NACL)
117 #include "components/nacl/common/nacl_constants.h"
118 #include "components/nacl/renderer/nacl_helper.h" 118 #include "components/nacl/renderer/nacl_helper.h"
119 #endif 119 #endif
120 120
121 #if defined(ENABLE_EXTENSIONS) 121 #if defined(ENABLE_EXTENSIONS)
122 #include "chrome/renderer/extensions/chrome_extensions_render_frame_observer.h" 122 #include "chrome/renderer/extensions/chrome_extensions_render_frame_observer.h"
123 #endif 123 #endif
124 124
125 #if defined(ENABLE_SPELLCHECK) 125 #if defined(ENABLE_SPELLCHECK)
126 #include "chrome/renderer/spellchecker/spellcheck.h" 126 #include "chrome/renderer/spellchecker/spellcheck.h"
127 #include "chrome/renderer/spellchecker/spellcheck_provider.h" 127 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 #endif 224 #endif
225 225
226 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings. 226 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
227 bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) { 227 bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
228 if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && 228 if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
229 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) { 229 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) {
230 return false; 230 return false;
231 } 231 }
232 232
233 #if !defined(DISABLE_NACL)
233 // Treat Native Client invocations like JavaScript. 234 // Treat Native Client invocations like JavaScript.
234 if (plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName)) 235 if (plugin.name == ASCIIToUTF16(nacl::kNaClPluginName))
235 return true; 236 return true;
237 #endif
236 238
237 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) 239 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
238 // Treat CDM invocations like JavaScript. 240 // Treat CDM invocations like JavaScript.
239 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { 241 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) {
240 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); 242 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
241 return true; 243 return true;
242 } 244 }
243 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) 245 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
244 246
245 return false; 247 return false;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; 671 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
670 } 672 }
671 #endif 673 #endif
672 674
673 switch (status_value) { 675 switch (status_value) {
674 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { 676 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: {
675 NOTREACHED(); 677 NOTREACHED();
676 break; 678 break;
677 } 679 }
678 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: { 680 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: {
681 #if !defined(DISABLE_NACL)
679 const bool is_nacl_plugin = 682 const bool is_nacl_plugin =
680 plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName); 683 plugin.name == ASCIIToUTF16(nacl::kNaClPluginName);
681 const bool is_nacl_mime_type = 684 const bool is_nacl_mime_type =
682 actual_mime_type == "application/x-nacl"; 685 actual_mime_type == nacl::kNaClPluginMimeType;
683 const bool is_pnacl_mime_type = 686 const bool is_pnacl_mime_type =
684 actual_mime_type == "application/x-pnacl"; 687 actual_mime_type == nacl::kPnaclPluginMimeType;
685 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) { 688 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) {
686 bool is_nacl_unrestricted = false; 689 bool is_nacl_unrestricted = false;
687 if (is_nacl_mime_type) { 690 if (is_nacl_mime_type) {
688 is_nacl_unrestricted = 691 is_nacl_unrestricted =
689 CommandLine::ForCurrentProcess()->HasSwitch( 692 CommandLine::ForCurrentProcess()->HasSwitch(
690 switches::kEnableNaCl); 693 switches::kEnableNaCl);
691 } else if (is_pnacl_mime_type) { 694 } else if (is_pnacl_mime_type) {
692 is_nacl_unrestricted = true; 695 is_nacl_unrestricted = true;
693 } 696 }
694 GURL manifest_url; 697 GURL manifest_url;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 group_name, 736 group_name,
734 IDR_BLOCKED_PLUGIN_HTML, 737 IDR_BLOCKED_PLUGIN_HTML,
735 #if defined(OS_CHROMEOS) 738 #if defined(OS_CHROMEOS)
736 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); 739 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED));
737 #else 740 #else
738 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); 741 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
739 #endif 742 #endif
740 break; 743 break;
741 } 744 }
742 } 745 }
746 #endif // !defined(DISABLE_NACL)
743 747
744 // Delay loading plugins if prerendering. 748 // Delay loading plugins if prerendering.
745 // TODO(mmenke): In the case of prerendering, feed into 749 // TODO(mmenke): In the case of prerendering, feed into
746 // ChromeContentRendererClient::CreatePlugin instead, to 750 // ChromeContentRendererClient::CreatePlugin instead, to
747 // reduce the chance of future regressions. 751 // reduce the chance of future regressions.
748 if (prerender::PrerenderHelper::IsPrerendering(render_frame)) { 752 if (prerender::PrerenderHelper::IsPrerendering(render_frame)) {
749 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin( 753 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin(
750 render_frame, 754 render_frame,
751 frame, 755 frame,
752 params, 756 params,
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 1506
1503 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_)) 1507 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_))
1504 return true; 1508 return true;
1505 1509
1506 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1510 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1507 return channel <= chrome::VersionInfo::CHANNEL_DEV; 1511 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1508 #else 1512 #else
1509 return false; 1513 return false;
1510 #endif 1514 #endif
1511 } 1515 }
OLDNEW
« no previous file with comments | « chrome/renderer/DEPS ('k') | components/nacl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698