| OLD | NEW |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "components/web_cache/renderer/web_cache_impl.h" | 85 #include "components/web_cache/renderer/web_cache_impl.h" |
| 86 #include "content/public/common/content_constants.h" | 86 #include "content/public/common/content_constants.h" |
| 87 #include "content/public/common/content_switches.h" | 87 #include "content/public/common/content_switches.h" |
| 88 #include "content/public/common/url_constants.h" | 88 #include "content/public/common/url_constants.h" |
| 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 "ipc/ipc_sync_channel.h" | 96 #include "ipc/ipc_sync_channel.h" |
| 96 #include "net/base/net_errors.h" | 97 #include "net/base/net_errors.h" |
| 97 #include "ppapi/c/private/ppb_pdf.h" | 98 #include "ppapi/c/private/ppb_pdf.h" |
| 98 #include "ppapi/shared_impl/ppapi_switches.h" | 99 #include "ppapi/shared_impl/ppapi_switches.h" |
| 99 #include "printing/features/features.h" | 100 #include "printing/features/features.h" |
| 100 #include "services/service_manager/public/cpp/interface_provider.h" | 101 #include "services/service_manager/public/cpp/interface_provider.h" |
| 101 #include "third_party/WebKit/public/platform/URLConversion.h" | 102 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 102 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 103 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
| 103 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 104 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 104 #include "third_party/WebKit/public/platform/WebURL.h" | 105 #include "third_party/WebKit/public/platform/WebURL.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 #include "ui/base/layout.h" | 118 #include "ui/base/layout.h" |
| 118 #include "ui/base/resource/resource_bundle.h" | 119 #include "ui/base/resource/resource_bundle.h" |
| 119 #include "ui/base/webui/jstemplate_builder.h" | 120 #include "ui/base/webui/jstemplate_builder.h" |
| 120 #include "url/origin.h" | 121 #include "url/origin.h" |
| 121 | 122 |
| 122 #if !defined(DISABLE_NACL) | 123 #if !defined(DISABLE_NACL) |
| 123 #include "components/nacl/common/nacl_constants.h" | 124 #include "components/nacl/common/nacl_constants.h" |
| 124 #include "components/nacl/renderer/nacl_helper.h" | 125 #include "components/nacl/renderer/nacl_helper.h" |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 #if defined(ENABLE_EXTENSIONS) | 128 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 128 #include "chrome/common/extensions/chrome_extensions_client.h" | 129 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 129 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" | 130 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" |
| 130 #include "extensions/common/extension_urls.h" | 131 #include "extensions/common/extension_urls.h" |
| 131 #include "extensions/common/switches.h" | 132 #include "extensions/common/switches.h" |
| 132 #include "extensions/renderer/dispatcher.h" | 133 #include "extensions/renderer/dispatcher.h" |
| 133 #include "extensions/renderer/renderer_extension_registry.h" | 134 #include "extensions/renderer/renderer_extension_registry.h" |
| 134 #endif | 135 #endif |
| 135 | 136 |
| 136 #if defined(ENABLE_PLUGINS) | 137 #if defined(ENABLE_PLUGINS) |
| 137 #include "chrome/common/plugin_utils.h" | 138 #include "chrome/common/plugin_utils.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 bool SpellCheckReplacer::Visit(content::RenderView* render_view) { | 256 bool SpellCheckReplacer::Visit(content::RenderView* render_view) { |
| 256 SpellCheckProvider* provider = SpellCheckProvider::Get(render_view); | 257 SpellCheckProvider* provider = SpellCheckProvider::Get(render_view); |
| 257 DCHECK(provider); | 258 DCHECK(provider); |
| 258 provider->set_spellcheck(spellcheck_); | 259 provider->set_spellcheck(spellcheck_); |
| 259 return true; | 260 return true; |
| 260 } | 261 } |
| 261 #endif | 262 #endif |
| 262 | 263 |
| 263 #if defined(ENABLE_EXTENSIONS) | 264 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 264 bool IsStandaloneExtensionProcess() { | 265 bool IsStandaloneExtensionProcess() { |
| 265 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 266 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 266 extensions::switches::kExtensionProcess); | 267 extensions::switches::kExtensionProcess); |
| 267 } | 268 } |
| 268 #endif | 269 #endif |
| 269 | 270 |
| 270 // Defers media player loading in background pages until they're visible. | 271 // Defers media player loading in background pages until they're visible. |
| 271 // TODO(dalecurtis): Include an idle listener too. http://crbug.com/509135 | 272 // TODO(dalecurtis): Include an idle listener too. http://crbug.com/509135 |
| 272 class MediaLoadDeferrer : public content::RenderFrameObserver { | 273 class MediaLoadDeferrer : public content::RenderFrameObserver { |
| 273 public: | 274 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 287 | 288 |
| 288 const base::Closure continue_loading_cb_; | 289 const base::Closure continue_loading_cb_; |
| 289 | 290 |
| 290 DISALLOW_COPY_AND_ASSIGN(MediaLoadDeferrer); | 291 DISALLOW_COPY_AND_ASSIGN(MediaLoadDeferrer); |
| 291 }; | 292 }; |
| 292 | 293 |
| 293 } // namespace | 294 } // namespace |
| 294 | 295 |
| 295 ChromeContentRendererClient::ChromeContentRendererClient() | 296 ChromeContentRendererClient::ChromeContentRendererClient() |
| 296 : main_entry_time_(base::TimeTicks::Now()) { | 297 : main_entry_time_(base::TimeTicks::Now()) { |
| 297 #if defined(ENABLE_EXTENSIONS) | 298 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 298 extensions::ExtensionsClient::Set( | 299 extensions::ExtensionsClient::Set( |
| 299 extensions::ChromeExtensionsClient::GetInstance()); | 300 extensions::ChromeExtensionsClient::GetInstance()); |
| 300 extensions::ExtensionsRendererClient::Set( | 301 extensions::ExtensionsRendererClient::Set( |
| 301 ChromeExtensionsRendererClient::GetInstance()); | 302 ChromeExtensionsRendererClient::GetInstance()); |
| 302 #endif | 303 #endif |
| 303 #if defined(ENABLE_PLUGINS) | 304 #if defined(ENABLE_PLUGINS) |
| 304 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) | 305 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) |
| 305 allowed_camera_device_origins_.insert( | 306 allowed_camera_device_origins_.insert( |
| 306 kPredefinedAllowedCameraDeviceOrigins[i]); | 307 kPredefinedAllowedCameraDeviceOrigins[i]); |
| 307 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) | 308 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 320 | 321 |
| 321 { | 322 { |
| 322 startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; | 323 startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; |
| 323 thread->GetRemoteInterfaces()->GetInterface(&startup_metric_host); | 324 thread->GetRemoteInterfaces()->GetInterface(&startup_metric_host); |
| 324 startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); | 325 startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); |
| 325 } | 326 } |
| 326 | 327 |
| 327 chrome_observer_.reset(new ChromeRenderThreadObserver()); | 328 chrome_observer_.reset(new ChromeRenderThreadObserver()); |
| 328 web_cache_impl_.reset(new web_cache::WebCacheImpl()); | 329 web_cache_impl_.reset(new web_cache::WebCacheImpl()); |
| 329 | 330 |
| 330 #if defined(ENABLE_EXTENSIONS) | 331 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 331 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); | 332 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); |
| 332 #endif | 333 #endif |
| 333 | 334 |
| 334 prescient_networking_dispatcher_.reset( | 335 prescient_networking_dispatcher_.reset( |
| 335 new network_hints::PrescientNetworkingDispatcher()); | 336 new network_hints::PrescientNetworkingDispatcher()); |
| 336 #if defined(ENABLE_SPELLCHECK) | 337 #if defined(ENABLE_SPELLCHECK) |
| 337 // ChromeRenderViewTest::SetUp() creates a Spellcheck and injects it using | 338 // ChromeRenderViewTest::SetUp() creates a Spellcheck and injects it using |
| 338 // SetSpellcheck(). Don't overwrite it. | 339 // SetSpellcheck(). Don't overwrite it. |
| 339 if (!spellcheck_) { | 340 if (!spellcheck_) { |
| 340 spellcheck_.reset(new SpellCheck()); | 341 spellcheck_.reset(new SpellCheck()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 438 } |
| 438 | 439 |
| 439 void ChromeContentRendererClient::RenderFrameCreated( | 440 void ChromeContentRendererClient::RenderFrameCreated( |
| 440 content::RenderFrame* render_frame) { | 441 content::RenderFrame* render_frame) { |
| 441 new ChromeRenderFrameObserver(render_frame); | 442 new ChromeRenderFrameObserver(render_frame); |
| 442 | 443 |
| 443 bool should_whitelist_for_content_settings = | 444 bool should_whitelist_for_content_settings = |
| 444 base::CommandLine::ForCurrentProcess()->HasSwitch( | 445 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 445 switches::kInstantProcess); | 446 switches::kInstantProcess); |
| 446 extensions::Dispatcher* ext_dispatcher = NULL; | 447 extensions::Dispatcher* ext_dispatcher = NULL; |
| 447 #if defined(ENABLE_EXTENSIONS) | 448 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 448 ext_dispatcher = | 449 ext_dispatcher = |
| 449 ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher(); | 450 ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher(); |
| 450 #endif | 451 #endif |
| 451 ContentSettingsObserver* content_settings = new ContentSettingsObserver( | 452 ContentSettingsObserver* content_settings = new ContentSettingsObserver( |
| 452 render_frame, ext_dispatcher, should_whitelist_for_content_settings); | 453 render_frame, ext_dispatcher, should_whitelist_for_content_settings); |
| 453 if (chrome_observer_.get()) { | 454 if (chrome_observer_.get()) { |
| 454 content_settings->SetContentSettingRules( | 455 content_settings->SetContentSettingRules( |
| 455 chrome_observer_->content_setting_rules()); | 456 chrome_observer_->content_setting_rules()); |
| 456 } | 457 } |
| 457 | 458 |
| 458 #if defined(ENABLE_EXTENSIONS) | 459 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 459 ChromeExtensionsRendererClient::GetInstance()->RenderFrameCreated( | 460 ChromeExtensionsRendererClient::GetInstance()->RenderFrameCreated( |
| 460 render_frame); | 461 render_frame); |
| 461 #endif | 462 #endif |
| 462 | 463 |
| 463 #if defined(ENABLE_PLUGINS) | 464 #if defined(ENABLE_PLUGINS) |
| 464 new PepperHelper(render_frame); | 465 new PepperHelper(render_frame); |
| 465 #endif | 466 #endif |
| 466 | 467 |
| 467 #if !defined(DISABLE_NACL) | 468 #if !defined(DISABLE_NACL) |
| 468 new nacl::NaClHelper(render_frame); | 469 new nacl::NaClHelper(render_frame); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 511 |
| 511 // There is no render thread, thus no RulesetDealer in ChromeRenderViewTests. | 512 // There is no render thread, thus no RulesetDealer in ChromeRenderViewTests. |
| 512 if (subresource_filter_ruleset_dealer_) { | 513 if (subresource_filter_ruleset_dealer_) { |
| 513 new subresource_filter::SubresourceFilterAgent( | 514 new subresource_filter::SubresourceFilterAgent( |
| 514 render_frame, subresource_filter_ruleset_dealer_.get()); | 515 render_frame, subresource_filter_ruleset_dealer_.get()); |
| 515 } | 516 } |
| 516 } | 517 } |
| 517 | 518 |
| 518 void ChromeContentRendererClient::RenderViewCreated( | 519 void ChromeContentRendererClient::RenderViewCreated( |
| 519 content::RenderView* render_view) { | 520 content::RenderView* render_view) { |
| 520 #if defined(ENABLE_EXTENSIONS) | 521 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 521 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); | 522 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); |
| 522 #endif | 523 #endif |
| 523 #if BUILDFLAG(ENABLE_PRINTING) | 524 #if BUILDFLAG(ENABLE_PRINTING) |
| 524 new printing::PrintWebViewHelper( | 525 new printing::PrintWebViewHelper( |
| 525 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( | 526 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( |
| 526 new ChromePrintWebViewHelperDelegate())); | 527 new ChromePrintWebViewHelperDelegate())); |
| 527 #endif | 528 #endif |
| 528 #if defined(ENABLE_SPELLCHECK) | 529 #if defined(ENABLE_SPELLCHECK) |
| 529 new SpellCheckProvider(render_view, spellcheck_.get()); | 530 new SpellCheckProvider(render_view, spellcheck_.get()); |
| 530 #endif | 531 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 549 return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance(). | 550 return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance(). |
| 550 GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap()); | 551 GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap()); |
| 551 } | 552 } |
| 552 | 553 |
| 553 bool ChromeContentRendererClient::OverrideCreatePlugin( | 554 bool ChromeContentRendererClient::OverrideCreatePlugin( |
| 554 content::RenderFrame* render_frame, | 555 content::RenderFrame* render_frame, |
| 555 WebLocalFrame* frame, | 556 WebLocalFrame* frame, |
| 556 const WebPluginParams& params, | 557 const WebPluginParams& params, |
| 557 WebPlugin** plugin) { | 558 WebPlugin** plugin) { |
| 558 std::string orig_mime_type = params.mimeType.utf8(); | 559 std::string orig_mime_type = params.mimeType.utf8(); |
| 559 #if defined(ENABLE_EXTENSIONS) | 560 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 560 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin( | 561 if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin( |
| 561 render_frame, params)) { | 562 render_frame, params)) { |
| 562 return false; | 563 return false; |
| 563 } | 564 } |
| 564 #endif | 565 #endif |
| 565 | 566 |
| 566 GURL url(params.url); | 567 GURL url(params.url); |
| 567 #if defined(ENABLE_PLUGINS) | 568 #if defined(ENABLE_PLUGINS) |
| 568 ChromeViewHostMsg_GetPluginInfo_Output output; | 569 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 569 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( | 570 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 render_frame, frame, params, info, identifier, group_name, | 685 render_frame, frame, params, info, identifier, group_name, |
| 685 template_id, message, PowerSaverInfo()); | 686 template_id, message, PowerSaverInfo()); |
| 686 }; | 687 }; |
| 687 switch (status) { | 688 switch (status) { |
| 688 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { | 689 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { |
| 689 NOTREACHED(); | 690 NOTREACHED(); |
| 690 break; | 691 break; |
| 691 } | 692 } |
| 692 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: | 693 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: |
| 693 case ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: { | 694 case ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: { |
| 694 #if !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS) | 695 #if !defined(DISABLE_NACL) && BUILDFLAG(ENABLE_EXTENSIONS) |
| 695 const bool is_nacl_plugin = | 696 const bool is_nacl_plugin = |
| 696 info.name == ASCIIToUTF16(nacl::kNaClPluginName); | 697 info.name == ASCIIToUTF16(nacl::kNaClPluginName); |
| 697 const bool is_nacl_mime_type = | 698 const bool is_nacl_mime_type = |
| 698 actual_mime_type == nacl::kNaClPluginMimeType; | 699 actual_mime_type == nacl::kNaClPluginMimeType; |
| 699 const bool is_pnacl_mime_type = | 700 const bool is_pnacl_mime_type = |
| 700 actual_mime_type == nacl::kPnaclPluginMimeType; | 701 actual_mime_type == nacl::kPnaclPluginMimeType; |
| 701 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) { | 702 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) { |
| 702 bool is_nacl_unrestricted = false; | 703 bool is_nacl_unrestricted = false; |
| 703 if (is_nacl_mime_type) { | 704 if (is_nacl_mime_type) { |
| 704 is_nacl_unrestricted = | 705 is_nacl_unrestricted = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 placeholder = create_blocked_plugin( | 744 placeholder = create_blocked_plugin( |
| 744 IDR_BLOCKED_PLUGIN_HTML, | 745 IDR_BLOCKED_PLUGIN_HTML, |
| 745 #if defined(OS_CHROMEOS) | 746 #if defined(OS_CHROMEOS) |
| 746 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); | 747 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); |
| 747 #else | 748 #else |
| 748 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); | 749 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); |
| 749 #endif | 750 #endif |
| 750 break; | 751 break; |
| 751 } | 752 } |
| 752 } | 753 } |
| 753 #endif // !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS) | 754 #endif // !defined(DISABLE_NACL) && BUILDFLAG(ENABLE_EXTENSIONS) |
| 754 | 755 |
| 755 // Delay loading plugins if prerendering. | 756 // Delay loading plugins if prerendering. |
| 756 // TODO(mmenke): In the case of prerendering, feed into | 757 // TODO(mmenke): In the case of prerendering, feed into |
| 757 // ChromeContentRendererClient::CreatePlugin instead, to | 758 // ChromeContentRendererClient::CreatePlugin instead, to |
| 758 // reduce the chance of future regressions. | 759 // reduce the chance of future regressions. |
| 759 bool is_prerendering = | 760 bool is_prerendering = |
| 760 prerender::PrerenderHelper::IsPrerendering(render_frame); | 761 prerender::PrerenderHelper::IsPrerendering(render_frame); |
| 761 | 762 |
| 762 bool power_saver_setting_on = | 763 bool power_saver_setting_on = |
| 763 status == | 764 status == |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 bool is_nacl_unrestricted, | 920 bool is_nacl_unrestricted, |
| 920 const Extension* extension, | 921 const Extension* extension, |
| 921 WebPluginParams* params) { | 922 WebPluginParams* params) { |
| 922 // Temporarily allow these whitelisted apps and WebUIs to use NaCl. | 923 // Temporarily allow these whitelisted apps and WebUIs to use NaCl. |
| 923 bool is_whitelisted_web_ui = | 924 bool is_whitelisted_web_ui = |
| 924 app_url.spec() == chrome::kChromeUIAppListStartPageURL; | 925 app_url.spec() == chrome::kChromeUIAppListStartPageURL; |
| 925 | 926 |
| 926 bool is_invoked_by_webstore_installed_extension = false; | 927 bool is_invoked_by_webstore_installed_extension = false; |
| 927 bool is_extension_unrestricted = false; | 928 bool is_extension_unrestricted = false; |
| 928 bool is_extension_force_installed = false; | 929 bool is_extension_force_installed = false; |
| 929 #if defined(ENABLE_EXTENSIONS) | 930 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 930 bool is_extension_from_webstore = extension && extension->from_webstore(); | 931 bool is_extension_from_webstore = extension && extension->from_webstore(); |
| 931 | 932 |
| 932 bool is_invoked_by_extension = app_url.SchemeIs("chrome-extension"); | 933 bool is_invoked_by_extension = app_url.SchemeIs("chrome-extension"); |
| 933 bool is_invoked_by_hosted_app = extension && | 934 bool is_invoked_by_hosted_app = extension && |
| 934 extension->is_hosted_app() && | 935 extension->is_hosted_app() && |
| 935 extension->web_extent().MatchesURL(app_url); | 936 extension->web_extent().MatchesURL(app_url); |
| 936 | 937 |
| 937 is_invoked_by_webstore_installed_extension = is_extension_from_webstore && | 938 is_invoked_by_webstore_installed_extension = is_extension_from_webstore && |
| 938 (is_invoked_by_extension || is_invoked_by_hosted_app); | 939 (is_invoked_by_extension || is_invoked_by_hosted_app); |
| 939 | 940 |
| 940 // Allow built-in extensions and developer mode extensions. | 941 // Allow built-in extensions and developer mode extensions. |
| 941 is_extension_unrestricted = extension && | 942 is_extension_unrestricted = extension && |
| 942 (extensions::Manifest::IsUnpackedLocation(extension->location()) || | 943 (extensions::Manifest::IsUnpackedLocation(extension->location()) || |
| 943 extensions::Manifest::IsComponentLocation(extension->location())); | 944 extensions::Manifest::IsComponentLocation(extension->location())); |
| 944 // Allow extensions force installed by admin policy. | 945 // Allow extensions force installed by admin policy. |
| 945 is_extension_force_installed = extension && | 946 is_extension_force_installed = extension && |
| 946 extensions::Manifest::IsPolicyLocation(extension->location()); | 947 extensions::Manifest::IsPolicyLocation(extension->location()); |
| 947 #endif // defined(ENABLE_EXTENSIONS) | 948 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 948 | 949 |
| 949 // Allow NaCl under any of the following circumstances: | 950 // Allow NaCl under any of the following circumstances: |
| 950 // 1) An app or URL is explictly whitelisted above. | 951 // 1) An app or URL is explictly whitelisted above. |
| 951 // 2) An extension is loaded unpacked or built-in (component) to Chrome. | 952 // 2) An extension is loaded unpacked or built-in (component) to Chrome. |
| 952 // 3) An extension is force installed by policy. | 953 // 3) An extension is force installed by policy. |
| 953 // 4) An extension is installed from the webstore, and invoked in that | 954 // 4) An extension is installed from the webstore, and invoked in that |
| 954 // context (hosted app URL or chrome-extension:// scheme). | 955 // context (hosted app URL or chrome-extension:// scheme). |
| 955 // 5) --enable-nacl is set. | 956 // 5) --enable-nacl is set. |
| 956 bool is_nacl_allowed_by_location = | 957 bool is_nacl_allowed_by_location = |
| 957 is_whitelisted_web_ui || | 958 is_whitelisted_web_ui || |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 ->GetErrorHTML(error, is_post, is_ignoring_cache, error_html); | 1035 ->GetErrorHTML(error, is_post, is_ignoring_cache, error_html); |
| 1035 } | 1036 } |
| 1036 | 1037 |
| 1037 if (error_description) { | 1038 if (error_description) { |
| 1038 *error_description = error_page::LocalizedError::GetErrorDetails( | 1039 *error_description = error_page::LocalizedError::GetErrorDetails( |
| 1039 error.domain.utf8(), error.reason, is_post); | 1040 error.domain.utf8(), error.reason, is_post); |
| 1040 } | 1041 } |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { | 1044 bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { |
| 1044 #if defined(ENABLE_EXTENSIONS) | 1045 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1045 return !IsStandaloneExtensionProcess(); | 1046 return !IsStandaloneExtensionProcess(); |
| 1046 #else | 1047 #else |
| 1047 return true; | 1048 return true; |
| 1048 #endif | 1049 #endif |
| 1049 } | 1050 } |
| 1050 | 1051 |
| 1051 bool ChromeContentRendererClient:: | 1052 bool ChromeContentRendererClient:: |
| 1052 AllowTimerSuspensionWhenProcessBackgrounded() { | 1053 AllowTimerSuspensionWhenProcessBackgrounded() { |
| 1053 #if defined(OS_ANDROID) | 1054 #if defined(OS_ANDROID) |
| 1054 return true; | 1055 return true; |
| 1055 #else | 1056 #else |
| 1056 return false; | 1057 return false; |
| 1057 #endif | 1058 #endif |
| 1058 } | 1059 } |
| 1059 | 1060 |
| 1060 bool ChromeContentRendererClient::AllowPopup() { | 1061 bool ChromeContentRendererClient::AllowPopup() { |
| 1061 #if defined(ENABLE_EXTENSIONS) | 1062 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1062 return ChromeExtensionsRendererClient::GetInstance()->AllowPopup(); | 1063 return ChromeExtensionsRendererClient::GetInstance()->AllowPopup(); |
| 1063 #else | 1064 #else |
| 1064 return false; | 1065 return false; |
| 1065 #endif | 1066 #endif |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 bool ChromeContentRendererClient::ShouldFork(WebLocalFrame* frame, | 1069 bool ChromeContentRendererClient::ShouldFork(WebLocalFrame* frame, |
| 1069 const GURL& url, | 1070 const GURL& url, |
| 1070 const std::string& http_method, | 1071 const std::string& http_method, |
| 1071 bool is_initial_navigation, | 1072 bool is_initial_navigation, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1098 // If |url| matches one of the prerendered URLs, stop this navigation and try | 1099 // If |url| matches one of the prerendered URLs, stop this navigation and try |
| 1099 // to swap in the prerendered page on the browser process. If the prerendered | 1100 // to swap in the prerendered page on the browser process. If the prerendered |
| 1100 // page no longer exists by the time the OpenURL IPC is handled, a normal | 1101 // page no longer exists by the time the OpenURL IPC is handled, a normal |
| 1101 // navigation is attempted. | 1102 // navigation is attempted. |
| 1102 if (prerender_dispatcher_.get() && | 1103 if (prerender_dispatcher_.get() && |
| 1103 prerender_dispatcher_->IsPrerenderURL(url)) { | 1104 prerender_dispatcher_->IsPrerenderURL(url)) { |
| 1104 *send_referrer = true; | 1105 *send_referrer = true; |
| 1105 return true; | 1106 return true; |
| 1106 } | 1107 } |
| 1107 | 1108 |
| 1108 #if defined(ENABLE_EXTENSIONS) | 1109 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1109 bool should_fork = ChromeExtensionsRendererClient::ShouldFork( | 1110 bool should_fork = ChromeExtensionsRendererClient::ShouldFork( |
| 1110 frame, url, is_initial_navigation, is_server_redirect, send_referrer); | 1111 frame, url, is_initial_navigation, is_server_redirect, send_referrer); |
| 1111 if (should_fork) | 1112 if (should_fork) |
| 1112 return true; | 1113 return true; |
| 1113 #endif // defined(ENABLE_EXTENSIONS) | 1114 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 1114 | 1115 |
| 1115 return false; | 1116 return false; |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 bool ChromeContentRendererClient::WillSendRequest( | 1119 bool ChromeContentRendererClient::WillSendRequest( |
| 1119 WebFrame* frame, | 1120 WebFrame* frame, |
| 1120 ui::PageTransition transition_type, | 1121 ui::PageTransition transition_type, |
| 1121 const blink::WebURL& url, | 1122 const blink::WebURL& url, |
| 1122 GURL* new_url) { | 1123 GURL* new_url) { |
| 1123 // Check whether the request should be allowed. If not allowed, we reset the | 1124 // Check whether the request should be allowed. If not allowed, we reset the |
| 1124 // URL to something invalid to prevent the request and cause an error. | 1125 // URL to something invalid to prevent the request and cause an error. |
| 1125 #if defined(ENABLE_EXTENSIONS) | 1126 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1126 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest( | 1127 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest( |
| 1127 frame, transition_type, url, new_url)) { | 1128 frame, transition_type, url, new_url)) { |
| 1128 return true; | 1129 return true; |
| 1129 } | 1130 } |
| 1130 #endif | 1131 #endif |
| 1131 | 1132 |
| 1132 if (!url.protocolIs(chrome::kChromeSearchScheme)) | 1133 if (!url.protocolIs(chrome::kChromeSearchScheme)) |
| 1133 return false; | 1134 return false; |
| 1134 | 1135 |
| 1135 const content::RenderView* render_view = | 1136 const content::RenderView* render_view = |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 #endif | 1202 #endif |
| 1202 | 1203 |
| 1203 bool ChromeContentRendererClient::IsExternalPepperPlugin( | 1204 bool ChromeContentRendererClient::IsExternalPepperPlugin( |
| 1204 const std::string& module_name) { | 1205 const std::string& module_name) { |
| 1205 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. | 1206 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. |
| 1206 // We must defer certain plugin events for NaCl instances since we switch | 1207 // We must defer certain plugin events for NaCl instances since we switch |
| 1207 // from the in-process to the out-of-process proxy after instantiating them. | 1208 // from the in-process to the out-of-process proxy after instantiating them. |
| 1208 return module_name == "Native Client"; | 1209 return module_name == "Native Client"; |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1212 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) |
| 1212 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( | 1213 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( |
| 1213 const GURL& url, const std::set<std::string>& whitelist) { | 1214 const GURL& url, const std::set<std::string>& whitelist) { |
| 1214 const extensions::ExtensionSet* extension_set = | 1215 const extensions::ExtensionSet* extension_set = |
| 1215 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet(); | 1216 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet(); |
| 1216 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 1217 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 1217 whitelist); | 1218 whitelist); |
| 1218 } | 1219 } |
| 1219 #endif | 1220 #endif |
| 1220 | 1221 |
| 1221 blink::WebSpeechSynthesizer* | 1222 blink::WebSpeechSynthesizer* |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1242 #endif // !defined(OS_ANDROID) | 1243 #endif // !defined(OS_ANDROID) |
| 1243 } | 1244 } |
| 1244 | 1245 |
| 1245 void ChromeContentRendererClient::AddSupportedKeySystems( | 1246 void ChromeContentRendererClient::AddSupportedKeySystems( |
| 1246 std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) { | 1247 std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) { |
| 1247 AddChromeKeySystems(key_systems); | 1248 AddChromeKeySystems(key_systems); |
| 1248 } | 1249 } |
| 1249 | 1250 |
| 1250 bool ChromeContentRendererClient::ShouldReportDetailedMessageForSource( | 1251 bool ChromeContentRendererClient::ShouldReportDetailedMessageForSource( |
| 1251 const base::string16& source) const { | 1252 const base::string16& source) const { |
| 1252 #if defined(ENABLE_EXTENSIONS) | 1253 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1253 return extensions::IsSourceFromAnExtension(source); | 1254 return extensions::IsSourceFromAnExtension(source); |
| 1254 #else | 1255 #else |
| 1255 return false; | 1256 return false; |
| 1256 #endif | 1257 #endif |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 bool ChromeContentRendererClient::ShouldGatherSiteIsolationStats() const { | 1260 bool ChromeContentRendererClient::ShouldGatherSiteIsolationStats() const { |
| 1260 // Site isolation stats are gathered currently for non-extension renderer | 1261 // Site isolation stats are gathered currently for non-extension renderer |
| 1261 // processes running a normal web page from the Internet. | 1262 // processes running a normal web page from the Internet. |
| 1262 // TODO(nick): https://crbug.com/268640 Gather stats for extension processes | 1263 // TODO(nick): https://crbug.com/268640 Gather stats for extension processes |
| 1263 // too; we would need to check the extension's manifest to know which sites | 1264 // too; we would need to check the extension's manifest to know which sites |
| 1264 // it's allowed to access. | 1265 // it's allowed to access. |
| 1265 #if defined(ENABLE_EXTENSIONS) | 1266 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1266 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 1267 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 1267 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); | 1268 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); |
| 1268 #else | 1269 #else |
| 1269 return true; | 1270 return true; |
| 1270 #endif | 1271 #endif |
| 1271 } | 1272 } |
| 1272 | 1273 |
| 1273 blink::WebWorkerContentSettingsClientProxy* | 1274 blink::WebWorkerContentSettingsClientProxy* |
| 1274 ChromeContentRendererClient::CreateWorkerContentSettingsClientProxy( | 1275 ChromeContentRendererClient::CreateWorkerContentSettingsClientProxy( |
| 1275 content::RenderFrame* render_frame, | 1276 content::RenderFrame* render_frame, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1290 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 1291 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
| 1291 // Chromium builds as well. | 1292 // Chromium builds as well. |
| 1292 return channel <= version_info::Channel::DEV; | 1293 return channel <= version_info::Channel::DEV; |
| 1293 #else | 1294 #else |
| 1294 return false; | 1295 return false; |
| 1295 #endif | 1296 #endif |
| 1296 } | 1297 } |
| 1297 | 1298 |
| 1298 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( | 1299 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( |
| 1299 const GURL& url) { | 1300 const GURL& url) { |
| 1300 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1301 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) |
| 1301 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1302 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1302 switches::kEnablePepperTesting)) | 1303 switches::kEnablePepperTesting)) |
| 1303 return true; | 1304 return true; |
| 1304 | 1305 |
| 1305 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) | 1306 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) |
| 1306 return true; | 1307 return true; |
| 1307 #endif | 1308 #endif |
| 1308 | 1309 |
| 1309 return false; | 1310 return false; |
| 1310 } | 1311 } |
| 1311 | 1312 |
| 1312 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( | 1313 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( |
| 1313 const GURL& url) { | 1314 const GURL& url) { |
| 1314 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1315 #if defined(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) |
| 1315 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1316 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1316 switches::kEnablePepperTesting)) | 1317 switches::kEnablePepperTesting)) |
| 1317 return true; | 1318 return true; |
| 1318 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) | 1319 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) |
| 1319 return true; | 1320 return true; |
| 1320 | 1321 |
| 1321 version_info::Channel channel = chrome::GetChannel(); | 1322 version_info::Channel channel = chrome::GetChannel(); |
| 1322 return channel <= version_info::Channel::DEV; | 1323 return channel <= version_info::Channel::DEV; |
| 1323 #else | 1324 #else |
| 1324 return false; | 1325 return false; |
| 1325 #endif | 1326 #endif |
| 1326 } | 1327 } |
| 1327 | 1328 |
| 1328 content::BrowserPluginDelegate* | 1329 content::BrowserPluginDelegate* |
| 1329 ChromeContentRendererClient::CreateBrowserPluginDelegate( | 1330 ChromeContentRendererClient::CreateBrowserPluginDelegate( |
| 1330 content::RenderFrame* render_frame, | 1331 content::RenderFrame* render_frame, |
| 1331 const std::string& mime_type, | 1332 const std::string& mime_type, |
| 1332 const GURL& original_url) { | 1333 const GURL& original_url) { |
| 1333 #if defined(ENABLE_EXTENSIONS) | 1334 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1334 return ChromeExtensionsRendererClient::CreateBrowserPluginDelegate( | 1335 return ChromeExtensionsRendererClient::CreateBrowserPluginDelegate( |
| 1335 render_frame, mime_type, original_url); | 1336 render_frame, mime_type, original_url); |
| 1336 #else | 1337 #else |
| 1337 return nullptr; | 1338 return nullptr; |
| 1338 #endif | 1339 #endif |
| 1339 } | 1340 } |
| 1340 | 1341 |
| 1341 void ChromeContentRendererClient::RecordRappor(const std::string& metric, | 1342 void ChromeContentRendererClient::RecordRappor(const std::string& metric, |
| 1342 const std::string& sample) { | 1343 const std::string& sample) { |
| 1343 if (!rappor_recorder_) | 1344 if (!rappor_recorder_) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1362 data_reduction_proxy::IsEmptyImagePreview( | 1363 data_reduction_proxy::IsEmptyImagePreview( |
| 1363 response.httpHeaderField(header_key).utf8())) { | 1364 response.httpHeaderField(header_key).utf8())) { |
| 1364 (*properties)[ | 1365 (*properties)[ |
| 1365 data_reduction_proxy::chrome_proxy_content_transform_header()] = | 1366 data_reduction_proxy::chrome_proxy_content_transform_header()] = |
| 1366 data_reduction_proxy::empty_image_directive(); | 1367 data_reduction_proxy::empty_image_directive(); |
| 1367 } | 1368 } |
| 1368 } | 1369 } |
| 1369 | 1370 |
| 1370 void ChromeContentRendererClient::RunScriptsAtDocumentStart( | 1371 void ChromeContentRendererClient::RunScriptsAtDocumentStart( |
| 1371 content::RenderFrame* render_frame) { | 1372 content::RenderFrame* render_frame) { |
| 1372 #if defined(ENABLE_EXTENSIONS) | 1373 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1373 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentStart( | 1374 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentStart( |
| 1374 render_frame); | 1375 render_frame); |
| 1375 // |render_frame| might be dead by now. | 1376 // |render_frame| might be dead by now. |
| 1376 #endif | 1377 #endif |
| 1377 } | 1378 } |
| 1378 | 1379 |
| 1379 void ChromeContentRendererClient::RunScriptsAtDocumentEnd( | 1380 void ChromeContentRendererClient::RunScriptsAtDocumentEnd( |
| 1380 content::RenderFrame* render_frame) { | 1381 content::RenderFrame* render_frame) { |
| 1381 #if defined(ENABLE_EXTENSIONS) | 1382 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1382 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentEnd( | 1383 ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentEnd( |
| 1383 render_frame); | 1384 render_frame); |
| 1384 // |render_frame| might be dead by now. | 1385 // |render_frame| might be dead by now. |
| 1385 #endif | 1386 #endif |
| 1386 } | 1387 } |
| 1387 | 1388 |
| 1388 void ChromeContentRendererClient:: | 1389 void ChromeContentRendererClient:: |
| 1389 DidInitializeServiceWorkerContextOnWorkerThread( | 1390 DidInitializeServiceWorkerContextOnWorkerThread( |
| 1390 v8::Local<v8::Context> context, | 1391 v8::Local<v8::Context> context, |
| 1391 int64_t service_worker_version_id, | 1392 int64_t service_worker_version_id, |
| 1392 const GURL& url) { | 1393 const GURL& url) { |
| 1393 #if defined(ENABLE_EXTENSIONS) | 1394 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1394 ChromeExtensionsRendererClient::GetInstance() | 1395 ChromeExtensionsRendererClient::GetInstance() |
| 1395 ->extension_dispatcher() | 1396 ->extension_dispatcher() |
| 1396 ->DidInitializeServiceWorkerContextOnWorkerThread( | 1397 ->DidInitializeServiceWorkerContextOnWorkerThread( |
| 1397 context, service_worker_version_id, url); | 1398 context, service_worker_version_id, url); |
| 1398 #endif | 1399 #endif |
| 1399 } | 1400 } |
| 1400 | 1401 |
| 1401 void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread( | 1402 void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread( |
| 1402 v8::Local<v8::Context> context, | 1403 v8::Local<v8::Context> context, |
| 1403 int64_t service_worker_version_id, | 1404 int64_t service_worker_version_id, |
| 1404 const GURL& url) { | 1405 const GURL& url) { |
| 1405 #if defined(ENABLE_EXTENSIONS) | 1406 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1406 extensions::Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread( | 1407 extensions::Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread( |
| 1407 context, service_worker_version_id, url); | 1408 context, service_worker_version_id, url); |
| 1408 #endif | 1409 #endif |
| 1409 } | 1410 } |
| 1410 | 1411 |
| 1411 // If we're in an extension, there is no need disabling multiple routes as | 1412 // If we're in an extension, there is no need disabling multiple routes as |
| 1412 // chrome.system.network.getNetworkInterfaces provides the same | 1413 // chrome.system.network.getNetworkInterfaces provides the same |
| 1413 // information. Also, the enforcement of sending and binding UDP is already done | 1414 // information. Also, the enforcement of sending and binding UDP is already done |
| 1414 // by chrome extension permission model. | 1415 // by chrome extension permission model. |
| 1415 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { | 1416 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { |
| 1416 #if defined(ENABLE_EXTENSIONS) | 1417 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1417 return !IsStandaloneExtensionProcess(); | 1418 return !IsStandaloneExtensionProcess(); |
| 1418 #else | 1419 #else |
| 1419 return true; | 1420 return true; |
| 1420 #endif | 1421 #endif |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 GURL ChromeContentRendererClient::OverrideFlashEmbedWithHTML(const GURL& url) { | 1424 GURL ChromeContentRendererClient::OverrideFlashEmbedWithHTML(const GURL& url) { |
| 1424 if (!base::FeatureList::IsEnabled(features::kOverrideYouTubeFlashEmbed)) | 1425 if (!base::FeatureList::IsEnabled(features::kOverrideYouTubeFlashEmbed)) |
| 1425 return GURL(); | 1426 return GURL(); |
| 1426 | 1427 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 | 1480 |
| 1480 url::Replacements<char> r; | 1481 url::Replacements<char> r; |
| 1481 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1482 r.SetPath(path.c_str(), url::Component(0, path.length())); |
| 1482 | 1483 |
| 1483 if (result == internal::NUM_PLUGIN_ERROR) | 1484 if (result == internal::NUM_PLUGIN_ERROR) |
| 1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1485 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
| 1485 | 1486 |
| 1486 RecordYouTubeRewriteUMA(result); | 1487 RecordYouTubeRewriteUMA(result); |
| 1487 return corrected_url.ReplaceComponents(r); | 1488 return corrected_url.ReplaceComponents(r); |
| 1488 } | 1489 } |
| OLD | NEW |