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

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: Rebase after 3 spin off CLs landed. Created 4 years 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 27 matching lines...) Expand all
38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
39 #include "chrome/browser/browsing_data/origin_filter_builder.h" 39 #include "chrome/browser/browsing_data/origin_filter_builder.h"
40 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" 40 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h"
41 #include "chrome/browser/budget_service/budget_service_impl.h" 41 #include "chrome/browser/budget_service/budget_service_impl.h"
42 #include "chrome/browser/character_encoding.h" 42 #include "chrome/browser/character_encoding.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_net_benchmarking_message_filter.h" 44 #include "chrome/browser/chrome_net_benchmarking_message_filter.h"
45 #include "chrome/browser/chrome_quota_permission_context.h" 45 #include "chrome/browser/chrome_quota_permission_context.h"
46 #include "chrome/browser/content_settings/cookie_settings_factory.h" 46 #include "chrome/browser/content_settings/cookie_settings_factory.h"
47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 47 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
48 #include "chrome/browser/content_settings/mixed_content_settings.h"
49 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
48 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 50 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
49 #include "chrome/browser/defaults.h" 51 #include "chrome/browser/defaults.h"
50 #include "chrome/browser/download/download_prefs.h" 52 #include "chrome/browser/download/download_prefs.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/notifications/platform_notification_service_impl.h" 60 #include "chrome/browser/notifications/platform_notification_service_impl.h"
58 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" 61 #include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h"
59 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 62 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
60 #include "chrome/browser/payments/payment_request_impl.h" 63 #include "chrome/browser/payments/payment_request_impl.h"
61 #include "chrome/browser/permissions/permission_context_base.h" 64 #include "chrome/browser/permissions/permission_context_base.h"
62 #include "chrome/browser/platform_util.h" 65 #include "chrome/browser/platform_util.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #include "chrome/common/chrome_switches.h" 107 #include "chrome/common/chrome_switches.h"
105 #include "chrome/common/env_vars.h" 108 #include "chrome/common/env_vars.h"
106 #include "chrome/common/features.h" 109 #include "chrome/common/features.h"
107 #include "chrome/common/logging_chrome.h" 110 #include "chrome/common/logging_chrome.h"
108 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h" 111 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h"
109 #include "chrome/common/pepper_permission_util.h" 112 #include "chrome/common/pepper_permission_util.h"
110 #include "chrome/common/pref_names.h" 113 #include "chrome/common/pref_names.h"
111 #include "chrome/common/render_messages.h" 114 #include "chrome/common/render_messages.h"
112 #include "chrome/common/renderer_configuration.mojom.h" 115 #include "chrome/common/renderer_configuration.mojom.h"
113 #include "chrome/common/secure_origin_whitelist.h" 116 #include "chrome/common/secure_origin_whitelist.h"
117 #include "chrome/common/ssl_insecure_content.h"
114 #include "chrome/common/stack_sampling_configuration.h" 118 #include "chrome/common/stack_sampling_configuration.h"
115 #include "chrome/common/url_constants.h" 119 #include "chrome/common/url_constants.h"
116 #include "chrome/grit/browser_resources.h" 120 #include "chrome/grit/browser_resources.h"
117 #include "chrome/grit/generated_resources.h" 121 #include "chrome/grit/generated_resources.h"
118 #include "chrome/installer/util/google_update_settings.h" 122 #include "chrome/installer/util/google_update_settings.h"
119 #include "chromeos/chromeos_constants.h" 123 #include "chromeos/chromeos_constants.h"
120 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 124 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
121 #include "components/autofill/core/common/autofill_switches.h" 125 #include "components/autofill/core/common/autofill_switches.h"
122 #include "components/cdm/browser/cdm_message_filter_android.h" 126 #include "components/cdm/browser/cdm_message_filter_android.h"
123 #include "components/cloud_devices/common/cloud_devices_switches.h" 127 #include "components/cloud_devices/common/cloud_devices_switches.h"
(...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 3300
3297 prerender::PrerenderManager* prerender_manager = 3301 prerender::PrerenderManager* prerender_manager =
3298 prerender::PrerenderManagerFactory::GetForBrowserContext( 3302 prerender::PrerenderManagerFactory::GetForBrowserContext(
3299 web_contents->GetBrowserContext()); 3303 web_contents->GetBrowserContext());
3300 if (prerender_manager && 3304 if (prerender_manager &&
3301 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { 3305 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) {
3302 *visibility_state = blink::WebPageVisibilityStatePrerender; 3306 *visibility_state = blink::WebPageVisibilityStatePrerender;
3303 } 3307 }
3304 } 3308 }
3305 3309
3310 void ChromeContentBrowserClient::PassiveInsecureContentFound(
3311 const GURL& resource_url) {
3312 // Note: this implementation is a mirror of
3313 // ContentSettingsObserver::passiveInsecureContentFound
3314 ReportInsecureContent(SslInsecureContentType::DISPLAY);
3315 FilteredReportInsecureContentDisplayed(resource_url);
3316 }
3317
3318 bool ChromeContentBrowserClient::ShouldAllowRunningInsecureContent(
3319 bool allowed_per_settings,
3320 const url::Origin& origin,
3321 const GURL& resource_url,
3322 content::WebContents* web_contents) {
3323 // Note: this implementation is a mirror of
3324 // ContentSettingsObserver::allowRunningInsecureContent
3325 FilteredReportInsecureContentRan(resource_url);
3326
3327 MixedContentSettings* mixed_content_settings =
3328 MixedContentSettings::FromWebContents(web_contents);
3329 DCHECK(mixed_content_settings);
3330 if (allowed_per_settings ||
3331 mixed_content_settings->insecure_content_allowed_running()) {
3332 return true;
3333 }
3334
3335 // Note: this is a browser-side-translation of the call to DidBlockContentType
3336 // from inside ContentSettingsObserver::allowRunningInsecureContent.
3337 if (!origin.host().empty()) {
3338 TabSpecificContentSettings* tab_settings =
3339 TabSpecificContentSettings::FromWebContents(web_contents);
3340 DCHECK(tab_settings);
3341 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT,
3342 base::UTF8ToUTF16(origin.host()));
3343 }
3344 return false;
3345 }
3346
3306 #if BUILDFLAG(ENABLE_WEBRTC) 3347 #if BUILDFLAG(ENABLE_WEBRTC)
3307 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( 3348 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
3308 base::CommandLine* to_command_line, 3349 base::CommandLine* to_command_line,
3309 const base::CommandLine& from_command_line, 3350 const base::CommandLine& from_command_line,
3310 version_info::Channel channel) { 3351 version_info::Channel channel) {
3311 #if defined(OS_ANDROID) 3352 #if defined(OS_ANDROID)
3312 const version_info::Channel kMaxDisableEncryptionChannel = 3353 const version_info::Channel kMaxDisableEncryptionChannel =
3313 version_info::Channel::BETA; 3354 version_info::Channel::BETA;
3314 #else 3355 #else
3315 const version_info::Channel kMaxDisableEncryptionChannel = 3356 const version_info::Channel kMaxDisableEncryptionChannel =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3419 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3379 return variations::GetVariationParamValue( 3420 return variations::GetVariationParamValue(
3380 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3421 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3381 } 3422 }
3382 3423
3383 // static 3424 // static
3384 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 3425 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
3385 const storage::QuotaSettings* settings) { 3426 const storage::QuotaSettings* settings) {
3386 g_default_quota_settings = settings; 3427 g_default_quota_settings = settings;
3387 } 3428 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698