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

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: Addressed all jam@ latest comments. 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 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 3290
3287 prerender::PrerenderManager* prerender_manager = 3291 prerender::PrerenderManager* prerender_manager =
3288 prerender::PrerenderManagerFactory::GetForBrowserContext( 3292 prerender::PrerenderManagerFactory::GetForBrowserContext(
3289 web_contents->GetBrowserContext()); 3293 web_contents->GetBrowserContext());
3290 if (prerender_manager && 3294 if (prerender_manager &&
3291 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) { 3295 prerender_manager->IsWebContentsPrerendering(web_contents, nullptr)) {
3292 *visibility_state = blink::WebPageVisibilityStatePrerender; 3296 *visibility_state = blink::WebPageVisibilityStatePrerender;
3293 } 3297 }
3294 } 3298 }
3295 3299
3300 void ChromeContentBrowserClient::PassiveInsecureContentFound(
3301 const GURL& resource_url) {
3302 // Note: this implementation is a mirror of
3303 // ContentSettingsObserver::passiveInsecureContentFound
3304 ReportInsecureContent(SslInsecureContentType::DISPLAY);
3305 FilteredReportInsecureContentDisplayed(resource_url);
3306 }
3307
3308 bool ChromeContentBrowserClient::ShouldAllowRunningInsecureContent(
3309 bool allowed_per_settings,
3310 const url::Origin& origin,
3311 const GURL& resource_url,
3312 content::WebContents* web_contents) {
3313 // Note: this implementation is a mirror of
3314 // ContentSettingsObserver::allowRunningInsecureContent
3315 FilteredReportInsecureContentRan(resource_url);
3316
3317 MixedContentSettings* mixed_content_settings =
3318 MixedContentSettings::FromWebContents(web_contents);
3319 DCHECK(mixed_content_settings);
3320 if (allowed_per_settings ||
3321 mixed_content_settings->insecure_content_allowed_running()) {
3322 return true;
3323 }
3324
3325 // Note: this is a browser-side-translation of the call to DidBlockContentType
3326 // from inside ContentSettingsObserver::allowRunningInsecureContent.
3327 if (!origin.host().empty()) {
3328 TabSpecificContentSettings* tab_settings =
3329 TabSpecificContentSettings::FromWebContents(web_contents);
3330 DCHECK(tab_settings);
3331 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT,
3332 base::UTF8ToUTF16(origin.host()));
3333 }
3334 return false;
3335 }
3336
3296 #if BUILDFLAG(ENABLE_WEBRTC) 3337 #if BUILDFLAG(ENABLE_WEBRTC)
3297 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch( 3338 void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
3298 base::CommandLine* to_command_line, 3339 base::CommandLine* to_command_line,
3299 const base::CommandLine& from_command_line, 3340 const base::CommandLine& from_command_line,
3300 version_info::Channel channel) { 3341 version_info::Channel channel) {
3301 #if defined(OS_ANDROID) 3342 #if defined(OS_ANDROID)
3302 const version_info::Channel kMaxDisableEncryptionChannel = 3343 const version_info::Channel kMaxDisableEncryptionChannel =
3303 version_info::Channel::BETA; 3344 version_info::Channel::BETA;
3304 #else 3345 #else
3305 const version_info::Channel kMaxDisableEncryptionChannel = 3346 const version_info::Channel kMaxDisableEncryptionChannel =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3362 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3403 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3363 return variations::GetVariationParamValue( 3404 return variations::GetVariationParamValue(
3364 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3405 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3365 } 3406 }
3366 3407
3367 bool ChromeContentBrowserClient:: 3408 bool ChromeContentBrowserClient::
3368 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3409 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3369 return variations::GetVariationParamValue( 3410 return variations::GetVariationParamValue(
3370 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3411 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3371 } 3412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698