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

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) cleanup 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
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; 670 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
669 } 671 }
670 #endif 672 #endif
671 673
672 switch (status_value) { 674 switch (status_value) {
673 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { 675 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: {
674 NOTREACHED(); 676 NOTREACHED();
675 break; 677 break;
676 } 678 }
677 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: { 679 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: {
680 #if !defined(DISABLE_NACL)
678 const bool is_nacl_plugin = 681 const bool is_nacl_plugin =
679 plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName); 682 plugin.name == ASCIIToUTF16(nacl::kNaClPluginName);
680 const bool is_nacl_mime_type = 683 const bool is_nacl_mime_type =
681 actual_mime_type == "application/x-nacl"; 684 actual_mime_type == nacl::kNaClPluginMimeType;
682 const bool is_pnacl_mime_type = 685 const bool is_pnacl_mime_type =
683 actual_mime_type == "application/x-pnacl"; 686 actual_mime_type == nacl::kPnaclPluginMimeType;
684 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) { 687 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) {
685 bool is_nacl_unrestricted = false; 688 bool is_nacl_unrestricted = false;
686 if (is_nacl_mime_type) { 689 if (is_nacl_mime_type) {
687 is_nacl_unrestricted = 690 is_nacl_unrestricted =
688 CommandLine::ForCurrentProcess()->HasSwitch( 691 CommandLine::ForCurrentProcess()->HasSwitch(
689 switches::kEnableNaCl); 692 switches::kEnableNaCl);
690 } else if (is_pnacl_mime_type) { 693 } else if (is_pnacl_mime_type) {
691 is_nacl_unrestricted = true; 694 is_nacl_unrestricted = true;
692 } 695 }
693 GURL manifest_url; 696 GURL manifest_url;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 group_name, 735 group_name,
733 IDR_BLOCKED_PLUGIN_HTML, 736 IDR_BLOCKED_PLUGIN_HTML,
734 #if defined(OS_CHROMEOS) 737 #if defined(OS_CHROMEOS)
735 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); 738 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED));
736 #else 739 #else
737 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); 740 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
738 #endif 741 #endif
739 break; 742 break;
740 } 743 }
741 } 744 }
745 #endif // !defined(DISABLE_NACL)
742 746
743 // Delay loading plugins if prerendering. 747 // Delay loading plugins if prerendering.
744 // TODO(mmenke): In the case of prerendering, feed into 748 // TODO(mmenke): In the case of prerendering, feed into
745 // ChromeContentRendererClient::CreatePlugin instead, to 749 // ChromeContentRendererClient::CreatePlugin instead, to
746 // reduce the chance of future regressions. 750 // reduce the chance of future regressions.
747 if (prerender::PrerenderHelper::IsPrerendering(render_frame)) { 751 if (prerender::PrerenderHelper::IsPrerendering(render_frame)) {
748 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin( 752 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin(
749 render_frame, 753 render_frame,
750 frame, 754 frame,
751 params, 755 params,
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 1505
1502 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_)) 1506 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_))
1503 return true; 1507 return true;
1504 1508
1505 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1509 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1506 return channel <= chrome::VersionInfo::CHANNEL_DEV; 1510 return channel <= chrome::VersionInfo::CHANNEL_DEV;
1507 #else 1511 #else
1508 return false; 1512 return false;
1509 #endif 1513 #endif
1510 } 1514 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698