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

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

Issue 2512563003: Convert enable_plugins to a buildflag header. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/BUILD.gn » ('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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "content/public/renderer/plugin_instance_throttler.h" 89 #include "content/public/renderer/plugin_instance_throttler.h"
90 #include "content/public/renderer/render_frame.h" 90 #include "content/public/renderer/render_frame.h"
91 #include "content/public/renderer/render_thread.h" 91 #include "content/public/renderer/render_thread.h"
92 #include "content/public/renderer/render_view.h" 92 #include "content/public/renderer/render_view.h"
93 #include "content/public/renderer/render_view_visitor.h" 93 #include "content/public/renderer/render_view_visitor.h"
94 #include "extensions/common/constants.h" 94 #include "extensions/common/constants.h"
95 #include "extensions/features/features.h" 95 #include "extensions/features/features.h"
96 #include "ipc/ipc_sync_channel.h" 96 #include "ipc/ipc_sync_channel.h"
97 #include "net/base/net_errors.h" 97 #include "net/base/net_errors.h"
98 #include "ppapi/c/private/ppb_pdf.h" 98 #include "ppapi/c/private/ppb_pdf.h"
99 #include "ppapi/features/features.h"
99 #include "ppapi/shared_impl/ppapi_switches.h" 100 #include "ppapi/shared_impl/ppapi_switches.h"
100 #include "printing/features/features.h" 101 #include "printing/features/features.h"
101 #include "services/service_manager/public/cpp/interface_provider.h" 102 #include "services/service_manager/public/cpp/interface_provider.h"
102 #include "third_party/WebKit/public/platform/URLConversion.h" 103 #include "third_party/WebKit/public/platform/URLConversion.h"
103 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 104 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
104 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 105 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
105 #include "third_party/WebKit/public/platform/WebURL.h" 106 #include "third_party/WebKit/public/platform/WebURL.h"
106 #include "third_party/WebKit/public/platform/WebURLError.h" 107 #include "third_party/WebKit/public/platform/WebURLError.h"
107 #include "third_party/WebKit/public/platform/WebURLRequest.h" 108 #include "third_party/WebKit/public/platform/WebURLRequest.h"
108 #include "third_party/WebKit/public/platform/WebURLResponse.h" 109 #include "third_party/WebKit/public/platform/WebURLResponse.h"
(...skipping 18 matching lines...) Expand all
127 128
128 #if BUILDFLAG(ENABLE_EXTENSIONS) 129 #if BUILDFLAG(ENABLE_EXTENSIONS)
129 #include "chrome/common/extensions/chrome_extensions_client.h" 130 #include "chrome/common/extensions/chrome_extensions_client.h"
130 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" 131 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
131 #include "extensions/common/extension_urls.h" 132 #include "extensions/common/extension_urls.h"
132 #include "extensions/common/switches.h" 133 #include "extensions/common/switches.h"
133 #include "extensions/renderer/dispatcher.h" 134 #include "extensions/renderer/dispatcher.h"
134 #include "extensions/renderer/renderer_extension_registry.h" 135 #include "extensions/renderer/renderer_extension_registry.h"
135 #endif 136 #endif
136 137
137 #if defined(ENABLE_PLUGINS) 138 #if BUILDFLAG(ENABLE_PLUGINS)
138 #include "chrome/common/plugin_utils.h" 139 #include "chrome/common/plugin_utils.h"
139 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 140 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
140 #include "chrome/renderer/plugins/power_saver_info.h" 141 #include "chrome/renderer/plugins/power_saver_info.h"
141 #else 142 #else
142 #include "components/plugins/renderer/plugin_placeholder.h" 143 #include "components/plugins/renderer/plugin_placeholder.h"
143 #endif 144 #endif
144 145
145 #if BUILDFLAG(ENABLE_PRINTING) 146 #if BUILDFLAG(ENABLE_PRINTING)
146 #include "chrome/common/chrome_content_client.h" 147 #include "chrome/common/chrome_content_client.h"
147 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" 148 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } // namespace internal 196 } // namespace internal
196 197
197 namespace { 198 namespace {
198 199
199 void RecordYouTubeRewriteUMA(internal::YouTubeRewriteStatus status) { 200 void RecordYouTubeRewriteUMA(internal::YouTubeRewriteStatus status) {
200 UMA_HISTOGRAM_ENUMERATION(internal::kFlashYouTubeRewriteUMA, status, 201 UMA_HISTOGRAM_ENUMERATION(internal::kFlashYouTubeRewriteUMA, status,
201 internal::NUM_PLUGIN_ERROR); 202 internal::NUM_PLUGIN_ERROR);
202 } 203 }
203 204
204 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) 205 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937)
205 #if defined(ENABLE_PLUGINS) 206 #if BUILDFLAG(ENABLE_PLUGINS)
206 const char* const kPredefinedAllowedCameraDeviceOrigins[] = { 207 const char* const kPredefinedAllowedCameraDeviceOrigins[] = {
207 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", 208 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F",
208 "4EB74897CB187C7633357C2FE832E0AD6A44883A" 209 "4EB74897CB187C7633357C2FE832E0AD6A44883A"
209 }; 210 };
210 211
211 const char* const kPredefinedAllowedCompositorOrigins[] = { 212 const char* const kPredefinedAllowedCompositorOrigins[] = {
212 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", 213 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F",
213 "4EB74897CB187C7633357C2FE832E0AD6A44883A" 214 "4EB74897CB187C7633357C2FE832E0AD6A44883A"
214 }; 215 };
215 #endif 216 #endif
216 217
217 #if defined(ENABLE_PLUGINS) 218 #if BUILDFLAG(ENABLE_PLUGINS)
218 void AppendParams(const std::vector<base::string16>& additional_names, 219 void AppendParams(const std::vector<base::string16>& additional_names,
219 const std::vector<base::string16>& additional_values, 220 const std::vector<base::string16>& additional_values,
220 WebVector<WebString>* existing_names, 221 WebVector<WebString>* existing_names,
221 WebVector<WebString>* existing_values) { 222 WebVector<WebString>* existing_values) {
222 DCHECK(additional_names.size() == additional_values.size()); 223 DCHECK(additional_names.size() == additional_values.size());
223 DCHECK(existing_names->size() == existing_values->size()); 224 DCHECK(existing_names->size() == existing_values->size());
224 225
225 size_t existing_size = existing_names->size(); 226 size_t existing_size = existing_names->size();
226 size_t total_size = existing_size + additional_names.size(); 227 size_t total_size = existing_size + additional_names.size();
227 228
228 WebVector<WebString> names(total_size); 229 WebVector<WebString> names(total_size);
229 WebVector<WebString> values(total_size); 230 WebVector<WebString> values(total_size);
230 231
231 for (size_t i = 0; i < existing_size; ++i) { 232 for (size_t i = 0; i < existing_size; ++i) {
232 names[i] = (*existing_names)[i]; 233 names[i] = (*existing_names)[i];
233 values[i] = (*existing_values)[i]; 234 values[i] = (*existing_values)[i];
234 } 235 }
235 236
236 for (size_t i = 0; i < additional_names.size(); ++i) { 237 for (size_t i = 0; i < additional_names.size(); ++i) {
237 names[existing_size + i] = additional_names[i]; 238 names[existing_size + i] = additional_names[i];
238 values[existing_size + i] = additional_values[i]; 239 values[existing_size + i] = additional_values[i];
239 } 240 }
240 241
241 existing_names->swap(names); 242 existing_names->swap(names);
242 existing_values->swap(values); 243 existing_values->swap(values);
243 } 244 }
244 #endif // defined(ENABLE_PLUGINS) 245 #endif // BUILDFLAG(ENABLE_PLUGINS)
245 246
246 #if BUILDFLAG(ENABLE_SPELLCHECK) 247 #if BUILDFLAG(ENABLE_SPELLCHECK)
247 class SpellCheckReplacer : public content::RenderViewVisitor { 248 class SpellCheckReplacer : public content::RenderViewVisitor {
248 public: 249 public:
249 explicit SpellCheckReplacer(SpellCheck* spellcheck) 250 explicit SpellCheckReplacer(SpellCheck* spellcheck)
250 : spellcheck_(spellcheck) {} 251 : spellcheck_(spellcheck) {}
251 bool Visit(content::RenderView* render_view) override; 252 bool Visit(content::RenderView* render_view) override;
252 253
253 private: 254 private:
254 SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr. 255 SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } // namespace 297 } // namespace
297 298
298 ChromeContentRendererClient::ChromeContentRendererClient() 299 ChromeContentRendererClient::ChromeContentRendererClient()
299 : main_entry_time_(base::TimeTicks::Now()) { 300 : main_entry_time_(base::TimeTicks::Now()) {
300 #if BUILDFLAG(ENABLE_EXTENSIONS) 301 #if BUILDFLAG(ENABLE_EXTENSIONS)
301 extensions::ExtensionsClient::Set( 302 extensions::ExtensionsClient::Set(
302 extensions::ChromeExtensionsClient::GetInstance()); 303 extensions::ChromeExtensionsClient::GetInstance());
303 extensions::ExtensionsRendererClient::Set( 304 extensions::ExtensionsRendererClient::Set(
304 ChromeExtensionsRendererClient::GetInstance()); 305 ChromeExtensionsRendererClient::GetInstance());
305 #endif 306 #endif
306 #if defined(ENABLE_PLUGINS) 307 #if BUILDFLAG(ENABLE_PLUGINS)
307 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) 308 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i)
308 allowed_camera_device_origins_.insert( 309 allowed_camera_device_origins_.insert(
309 kPredefinedAllowedCameraDeviceOrigins[i]); 310 kPredefinedAllowedCameraDeviceOrigins[i]);
310 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) 311 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i)
311 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); 312 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]);
312 #endif 313 #endif
313 #if BUILDFLAG(ENABLE_PRINTING) 314 #if BUILDFLAG(ENABLE_PRINTING)
314 printing::SetAgent(GetUserAgent()); 315 printing::SetAgent(GetUserAgent());
315 #endif 316 #endif
316 } 317 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (chrome_observer_.get()) { 457 if (chrome_observer_.get()) {
457 content_settings->SetContentSettingRules( 458 content_settings->SetContentSettingRules(
458 chrome_observer_->content_setting_rules()); 459 chrome_observer_->content_setting_rules());
459 } 460 }
460 461
461 #if BUILDFLAG(ENABLE_EXTENSIONS) 462 #if BUILDFLAG(ENABLE_EXTENSIONS)
462 ChromeExtensionsRendererClient::GetInstance()->RenderFrameCreated( 463 ChromeExtensionsRendererClient::GetInstance()->RenderFrameCreated(
463 render_frame); 464 render_frame);
464 #endif 465 #endif
465 466
466 #if defined(ENABLE_PLUGINS) 467 #if BUILDFLAG(ENABLE_PLUGINS)
467 new PepperHelper(render_frame); 468 new PepperHelper(render_frame);
468 #endif 469 #endif
469 470
470 #if !defined(DISABLE_NACL) 471 #if !defined(DISABLE_NACL)
471 new nacl::NaClHelper(render_frame); 472 new nacl::NaClHelper(render_frame);
472 #endif 473 #endif
473 474
474 #if defined(FULL_SAFE_BROWSING) 475 #if defined(FULL_SAFE_BROWSING)
475 safe_browsing::ThreatDOMDetails::Create(render_frame); 476 safe_browsing::ThreatDOMDetails::Create(render_frame);
476 #endif 477 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 WebPlugin** plugin) { 561 WebPlugin** plugin) {
561 std::string orig_mime_type = params.mimeType.utf8(); 562 std::string orig_mime_type = params.mimeType.utf8();
562 #if BUILDFLAG(ENABLE_EXTENSIONS) 563 #if BUILDFLAG(ENABLE_EXTENSIONS)
563 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin( 564 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin(
564 render_frame, params)) { 565 render_frame, params)) {
565 return false; 566 return false;
566 } 567 }
567 #endif 568 #endif
568 569
569 GURL url(params.url); 570 GURL url(params.url);
570 #if defined(ENABLE_PLUGINS) 571 #if BUILDFLAG(ENABLE_PLUGINS)
571 ChromeViewHostMsg_GetPluginInfo_Output output; 572 ChromeViewHostMsg_GetPluginInfo_Output output;
572 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( 573 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo(
573 render_frame->GetRoutingID(), url, frame->top()->getSecurityOrigin(), 574 render_frame->GetRoutingID(), url, frame->top()->getSecurityOrigin(),
574 orig_mime_type, &output)); 575 orig_mime_type, &output));
575 *plugin = CreatePlugin(render_frame, frame, params, output); 576 *plugin = CreatePlugin(render_frame, frame, params, output);
576 #else // !defined(ENABLE_PLUGINS) 577 #else // !BUILDFLAG(ENABLE_PLUGINS)
577 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, url); 578 PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, url);
578 *plugin = NonLoadablePluginPlaceholder::CreateNotSupportedPlugin( 579 *plugin = NonLoadablePluginPlaceholder::CreateNotSupportedPlugin(
579 render_frame, frame, params)->plugin(); 580 render_frame, frame, params)->plugin();
580 581
581 #endif // defined(ENABLE_PLUGINS) 582 #endif // BUILDFLAG(ENABLE_PLUGINS)
582 return true; 583 return true;
583 } 584 }
584 585
585 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement( 586 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement(
586 content::RenderFrame* render_frame, 587 content::RenderFrame* render_frame,
587 const base::FilePath& plugin_path) { 588 const base::FilePath& plugin_path) {
588 return NonLoadablePluginPlaceholder::CreateErrorPlugin(render_frame, 589 return NonLoadablePluginPlaceholder::CreateErrorPlugin(render_frame,
589 plugin_path)->plugin(); 590 plugin_path)->plugin();
590 } 591 }
591 592
(...skipping 13 matching lines...) Expand all
605 !base::CommandLine::ForCurrentProcess()->HasSwitch( 606 !base::CommandLine::ForCurrentProcess()->HasSwitch(
606 switches::kDisableGestureRequirementForMediaPlayback)) || 607 switches::kDisableGestureRequirementForMediaPlayback)) ||
607 prerender::PrerenderHelper::IsPrerendering(render_frame)) { 608 prerender::PrerenderHelper::IsPrerendering(render_frame)) {
608 new MediaLoadDeferrer(render_frame, closure); 609 new MediaLoadDeferrer(render_frame, closure);
609 return; 610 return;
610 } 611 }
611 612
612 closure.Run(); 613 closure.Run();
613 } 614 }
614 615
615 #if defined(ENABLE_PLUGINS) 616 #if BUILDFLAG(ENABLE_PLUGINS)
616 WebPlugin* ChromeContentRendererClient::CreatePlugin( 617 WebPlugin* ChromeContentRendererClient::CreatePlugin(
617 content::RenderFrame* render_frame, 618 content::RenderFrame* render_frame,
618 WebLocalFrame* frame, 619 WebLocalFrame* frame,
619 const WebPluginParams& original_params, 620 const WebPluginParams& original_params,
620 const ChromeViewHostMsg_GetPluginInfo_Output& output) { 621 const ChromeViewHostMsg_GetPluginInfo_Output& output) {
621 const WebPluginInfo& info = output.plugin; 622 const WebPluginInfo& info = output.plugin;
622 const std::string& actual_mime_type = output.actual_mime_type; 623 const std::string& actual_mime_type = output.actual_mime_type;
623 const base::string16& group_name = output.group_name; 624 const base::string16& group_name = output.group_name;
624 const std::string& identifier = output.group_identifier; 625 const std::string& identifier = output.group_identifier;
625 ChromeViewHostMsg_GetPluginInfo_Status status = output.status; 626 ChromeViewHostMsg_GetPluginInfo_Status status = output.status;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 IDR_BLOCKED_PLUGIN_HTML, 872 IDR_BLOCKED_PLUGIN_HTML,
872 l10n_util::GetStringFUTF16(IDS_PLUGIN_RESTART_REQUIRED, 873 l10n_util::GetStringFUTF16(IDS_PLUGIN_RESTART_REQUIRED,
873 group_name)); 874 group_name));
874 break; 875 break;
875 } 876 }
876 } 877 }
877 } 878 }
878 placeholder->SetStatus(status); 879 placeholder->SetStatus(status);
879 return placeholder->plugin(); 880 return placeholder->plugin();
880 } 881 }
881 #endif // defined(ENABLE_PLUGINS) 882 #endif // BUILDFLAG(ENABLE_PLUGINS)
882 883
883 // For NaCl content handling plugins, the NaCl manifest is stored in an 884 // For NaCl content handling plugins, the NaCl manifest is stored in an
884 // additonal 'nacl' param associated with the MIME type. 885 // additonal 'nacl' param associated with the MIME type.
885 // static 886 // static
886 GURL ChromeContentRendererClient::GetNaClContentHandlerURL( 887 GURL ChromeContentRendererClient::GetNaClContentHandlerURL(
887 const std::string& actual_mime_type, 888 const std::string& actual_mime_type,
888 const content::WebPluginInfo& plugin) { 889 const content::WebPluginInfo& plugin) {
889 // Look for the manifest URL among the MIME type's additonal parameters. 890 // Look for the manifest URL among the MIME type's additonal parameters.
890 const char kNaClPluginManifestAttribute[] = "nacl"; 891 const char kNaClPluginManifestAttribute[] = "nacl";
891 base::string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); 892 base::string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 #endif 1193 #endif
1193 1194
1194 bool ChromeContentRendererClient::IsExternalPepperPlugin( 1195 bool ChromeContentRendererClient::IsExternalPepperPlugin(
1195 const std::string& module_name) { 1196 const std::string& module_name) {
1196 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. 1197 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed.
1197 // We must defer certain plugin events for NaCl instances since we switch 1198 // We must defer certain plugin events for NaCl instances since we switch
1198 // from the in-process to the out-of-process proxy after instantiating them. 1199 // from the in-process to the out-of-process proxy after instantiating them.
1199 return module_name == "Native Client"; 1200 return module_name == "Native Client";
1200 } 1201 }
1201 1202
1202 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) 1203 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS)
1203 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( 1204 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted(
1204 const GURL& url, const std::set<std::string>& whitelist) { 1205 const GURL& url, const std::set<std::string>& whitelist) {
1205 const extensions::ExtensionSet* extension_set = 1206 const extensions::ExtensionSet* extension_set =
1206 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet(); 1207 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet();
1207 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set, 1208 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set,
1208 whitelist); 1209 whitelist);
1209 } 1210 }
1210 #endif 1211 #endif
1211 1212
1212 blink::WebSpeechSynthesizer* 1213 blink::WebSpeechSynthesizer*
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 } 1263 }
1263 1264
1264 blink::WebWorkerContentSettingsClientProxy* 1265 blink::WebWorkerContentSettingsClientProxy*
1265 ChromeContentRendererClient::CreateWorkerContentSettingsClientProxy( 1266 ChromeContentRendererClient::CreateWorkerContentSettingsClientProxy(
1266 content::RenderFrame* render_frame, 1267 content::RenderFrame* render_frame,
1267 WebFrame* frame) { 1268 WebFrame* frame) {
1268 return new WorkerContentSettingsClientProxy(render_frame, frame); 1269 return new WorkerContentSettingsClientProxy(render_frame, frame);
1269 } 1270 }
1270 1271
1271 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { 1272 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() {
1272 #if defined(ENABLE_PLUGINS) 1273 #if BUILDFLAG(ENABLE_PLUGINS)
1273 // Allow access for tests. 1274 // Allow access for tests.
1274 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1275 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1275 switches::kEnablePepperTesting)) { 1276 switches::kEnablePepperTesting)) {
1276 return true; 1277 return true;
1277 } 1278 }
1278 1279
1279 version_info::Channel channel = chrome::GetChannel(); 1280 version_info::Channel channel = chrome::GetChannel();
1280 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" 1281 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown"
1281 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on 1282 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on
1282 // Chromium builds as well. 1283 // Chromium builds as well.
1283 return channel <= version_info::Channel::DEV; 1284 return channel <= version_info::Channel::DEV;
1284 #else 1285 #else
1285 return false; 1286 return false;
1286 #endif 1287 #endif
1287 } 1288 }
1288 1289
1289 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( 1290 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI(
1290 const GURL& url) { 1291 const GURL& url) {
1291 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) 1292 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS)
1292 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1293 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1293 switches::kEnablePepperTesting)) 1294 switches::kEnablePepperTesting))
1294 return true; 1295 return true;
1295 1296
1296 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) 1297 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_))
1297 return true; 1298 return true;
1298 #endif 1299 #endif
1299 1300
1300 return false; 1301 return false;
1301 } 1302 }
1302 1303
1303 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( 1304 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI(
1304 const GURL& url) { 1305 const GURL& url) {
1305 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) 1306 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS)
1306 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1307 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1307 switches::kEnablePepperTesting)) 1308 switches::kEnablePepperTesting))
1308 return true; 1309 return true;
1309 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) 1310 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_))
1310 return true; 1311 return true;
1311 1312
1312 version_info::Channel channel = chrome::GetChannel(); 1313 version_info::Channel channel = chrome::GetChannel();
1313 return channel <= version_info::Channel::DEV; 1314 return channel <= version_info::Channel::DEV;
1314 #else 1315 #else
1315 return false; 1316 return false;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 1471
1471 url::Replacements<char> r; 1472 url::Replacements<char> r;
1472 r.SetPath(path.c_str(), url::Component(0, path.length())); 1473 r.SetPath(path.c_str(), url::Component(0, path.length()));
1473 1474
1474 if (result == internal::NUM_PLUGIN_ERROR) 1475 if (result == internal::NUM_PLUGIN_ERROR)
1475 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; 1476 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS;
1476 1477
1477 RecordYouTubeRewriteUMA(result); 1478 RecordYouTubeRewriteUMA(result);
1478 return corrected_url.ReplaceComponents(r); 1479 return corrected_url.ReplaceComponents(r);
1479 } 1480 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698