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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: MixedContent::ContextType comes from the renderer; lessen Blink public code; fixed build. Created 3 years, 11 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
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/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 #include "chrome/browser/browsing_data/browsing_data_helper.h" 37 #include "chrome/browser/browsing_data/browsing_data_helper.h"
38 #include "chrome/browser/browsing_data/browsing_data_remover.h" 38 #include "chrome/browser/browsing_data/browsing_data_remover.h"
39 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 39 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
40 #include "chrome/browser/browsing_data/origin_filter_builder.h" 40 #include "chrome/browser/browsing_data/origin_filter_builder.h"
41 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" 41 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h"
42 #include "chrome/browser/budget_service/budget_service_impl.h" 42 #include "chrome/browser/budget_service/budget_service_impl.h"
43 #include "chrome/browser/chrome_content_browser_client_parts.h" 43 #include "chrome/browser/chrome_content_browser_client_parts.h"
44 #include "chrome/browser/chrome_quota_permission_context.h" 44 #include "chrome/browser/chrome_quota_permission_context.h"
45 #include "chrome/browser/content_settings/cookie_settings_factory.h" 45 #include "chrome/browser/content_settings/cookie_settings_factory.h"
46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
47 #include "chrome/browser/content_settings/mixed_content_settings.h"
48 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
47 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 49 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
48 #include "chrome/browser/defaults.h" 50 #include "chrome/browser/defaults.h"
49 #include "chrome/browser/download/download_prefs.h" 51 #include "chrome/browser/download/download_prefs.h"
50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" 52 #include "chrome/browser/engagement/site_engagement_eviction_policy.h"
51 #include "chrome/browser/field_trial_recorder.h" 53 #include "chrome/browser/field_trial_recorder.h"
52 #include "chrome/browser/font_family_cache.h" 54 #include "chrome/browser/font_family_cache.h"
55 #include "chrome/browser/infobars/infobar_service.h"
53 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" 56 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
54 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h" 57 #include "chrome/browser/memory/chrome_memory_coordinator_delegate.h"
55 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" 58 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
56 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" 59 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h"
57 #include "chrome/browser/net_benchmarking.h" 60 #include "chrome/browser/net_benchmarking.h"
58 #include "chrome/browser/notifications/platform_notification_service_impl.h" 61 #include "chrome/browser/notifications/platform_notification_service_impl.h"
59 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" 62 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h"
60 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 63 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
61 #include "chrome/browser/payments/payment_request_impl.h" 64 #include "chrome/browser/payments/payment_request_impl.h"
62 #include "chrome/browser/permissions/permission_context_base.h" 65 #include "chrome/browser/permissions/permission_context_base.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #include "chrome/common/chrome_switches.h" 109 #include "chrome/common/chrome_switches.h"
107 #include "chrome/common/env_vars.h" 110 #include "chrome/common/env_vars.h"
108 #include "chrome/common/features.h" 111 #include "chrome/common/features.h"
109 #include "chrome/common/logging_chrome.h" 112 #include "chrome/common/logging_chrome.h"
110 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h" 113 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h"
111 #include "chrome/common/pepper_permission_util.h" 114 #include "chrome/common/pepper_permission_util.h"
112 #include "chrome/common/pref_names.h" 115 #include "chrome/common/pref_names.h"
113 #include "chrome/common/render_messages.h" 116 #include "chrome/common/render_messages.h"
114 #include "chrome/common/renderer_configuration.mojom.h" 117 #include "chrome/common/renderer_configuration.mojom.h"
115 #include "chrome/common/secure_origin_whitelist.h" 118 #include "chrome/common/secure_origin_whitelist.h"
119 #include "chrome/common/ssl_insecure_content.h"
116 #include "chrome/common/stack_sampling_configuration.h" 120 #include "chrome/common/stack_sampling_configuration.h"
117 #include "chrome/common/url_constants.h" 121 #include "chrome/common/url_constants.h"
118 #include "chrome/grit/browser_resources.h" 122 #include "chrome/grit/browser_resources.h"
119 #include "chrome/grit/generated_resources.h" 123 #include "chrome/grit/generated_resources.h"
120 #include "chrome/installer/util/google_update_settings.h" 124 #include "chrome/installer/util/google_update_settings.h"
121 #include "chromeos/chromeos_constants.h" 125 #include "chromeos/chromeos_constants.h"
122 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 126 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
123 #include "components/autofill/core/common/autofill_switches.h" 127 #include "components/autofill/core/common/autofill_switches.h"
124 #include "components/browsing_data/core/browsing_data_utils.h" 128 #include "components/browsing_data/core/browsing_data_utils.h"
125 #include "components/cdm/browser/cdm_message_filter_android.h" 129 #include "components/cdm/browser/cdm_message_filter_android.h"
(...skipping 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3295 3299
3296 prerender::PrerenderManager* prerender_manager = 3300 prerender::PrerenderManager* prerender_manager =
3297 prerender::PrerenderManagerFactory::GetForBrowserContext( 3301 prerender::PrerenderManagerFactory::GetForBrowserContext(
3298 web_contents->GetBrowserContext()); 3302 web_contents->GetBrowserContext());
3299 if (prerender_manager && 3303 if (prerender_manager &&
3300 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { 3304 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) {
3301 *visibility_state = blink::WebPageVisibilityStatePrerender; 3305 *visibility_state = blink::WebPageVisibilityStatePrerender;
3302 } 3306 }
3303 } 3307 }
3304 3308
3309 void ChromeContentBrowserClient::PassiveInsecureContentFound(
3310 const GURL& resource_url) {
3311 // Note: this implementation is a mirror of
3312 // ContentSettingsObserver::passiveInsecureContentFound
3313 ReportInsecureContent(SslInsecureContentType::DISPLAY);
3314 FilteredReportInsecureContentDisplayed(resource_url);
3315 }
3316
3317 bool ChromeContentBrowserClient::ShouldAllowRunningInsecureContent(
3318 bool allowed_per_settings,
3319 const url::Origin& origin,
3320 const GURL& resource_url,
3321 content::WebContents* web_contents) {
3322 // Note: this implementation is a mirror of
3323 // ContentSettingsObserver::allowRunningInsecureContent
3324 FilteredReportInsecureContentRan(resource_url);
3325
3326 MixedContentSettings* mixed_content_settings =
3327 MixedContentSettings::FromWebContents(web_contents);
3328 DCHECK(mixed_content_settings);
3329 if (allowed_per_settings ||
3330 mixed_content_settings->insecure_content_allowed_running()) {
3331 return true;
3332 }
3333
3334 // Note: this is a browser-side-translation of the call to DidBlockContentType
3335 // from inside ContentSettingsObserver::allowRunningInsecureContent.
3336 if (!origin.host().empty()) {
3337 TabSpecificContentSettings* tab_settings =
3338 TabSpecificContentSettings::FromWebContents(web_contents);
3339 DCHECK(tab_settings);
3340 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT,
3341 base::UTF8ToUTF16(origin.host()));
3342 }
3343 return false;
3344 }
3345
3305 #if BUILDFLAG(ENABLE_WEBRTC) 3346 #if BUILDFLAG(ENABLE_WEBRTC)
3306 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( 3347 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
3307 base::CommandLine* to_command_line, 3348 base::CommandLine* to_command_line,
3308 const base::CommandLine& from_command_line, 3349 const base::CommandLine& from_command_line,
3309 version_info::Channel channel) { 3350 version_info::Channel channel) {
3310 #if defined(OS_ANDROID) 3351 #if defined(OS_ANDROID)
3311 const version_info::Channel kMaxDisableEncryptionChannel = 3352 const version_info::Channel kMaxDisableEncryptionChannel =
3312 version_info::Channel::BETA; 3353 version_info::Channel::BETA;
3313 #else 3354 #else
3314 const version_info::Channel kMaxDisableEncryptionChannel = 3355 const version_info::Channel kMaxDisableEncryptionChannel =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3412 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3372 return variations::GetVariationParamValue( 3413 return variations::GetVariationParamValue(
3373 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3414 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3374 } 3415 }
3375 3416
3376 bool ChromeContentBrowserClient:: 3417 bool ChromeContentBrowserClient::
3377 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3418 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3378 return variations::GetVariationParamValue( 3419 return variations::GetVariationParamValue(
3379 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3420 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3380 } 3421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698