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/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 #include "chrome/browser/prerender/prerender_manager.h" | 65 #include "chrome/browser/prerender/prerender_manager.h" |
66 #include "chrome/browser/prerender/prerender_manager_factory.h" | 66 #include "chrome/browser/prerender/prerender_manager_factory.h" |
67 #include "chrome/browser/prerender/prerender_message_filter.h" | 67 #include "chrome/browser/prerender/prerender_message_filter.h" |
68 #include "chrome/browser/printing/printing_message_filter.h" | 68 #include "chrome/browser/printing/printing_message_filter.h" |
69 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 69 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
70 #include "chrome/browser/profiles/profile.h" | 70 #include "chrome/browser/profiles/profile.h" |
71 #include "chrome/browser/profiles/profile_io_data.h" | 71 #include "chrome/browser/profiles/profile_io_data.h" |
72 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" | 72 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
73 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 73 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
74 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" | 74 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" |
75 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 75 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
76 #include "chrome/browser/safe_browsing/ui_manager.h" | 76 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
77 #include "chrome/browser/search/instant_service.h" | 77 #include "chrome/browser/search/instant_service.h" |
78 #include "chrome/browser/search/instant_service_factory.h" | 78 #include "chrome/browser/search/instant_service_factory.h" |
79 #include "chrome/browser/search/search.h" | 79 #include "chrome/browser/search/search.h" |
80 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 80 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
81 #include "chrome/browser/speech/tts_controller.h" | 81 #include "chrome/browser/speech/tts_controller.h" |
82 #include "chrome/browser/speech/tts_message_filter.h" | 82 #include "chrome/browser/speech/tts_message_filter.h" |
83 #include "chrome/browser/ssl/ssl_blocking_page.h" | 83 #include "chrome/browser/ssl/ssl_blocking_page.h" |
84 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 84 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
85 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 85 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
86 #include "chrome/browser/ssl/ssl_error_handler.h" | 86 #include "chrome/browser/ssl/ssl_error_handler.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 #include "components/metrics/client_info.h" | 134 #include "components/metrics/client_info.h" |
135 #include "components/net_log/chrome_net_log.h" | 135 #include "components/net_log/chrome_net_log.h" |
136 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" | 136 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" |
137 #include "components/payments/payment_request.mojom.h" | 137 #include "components/payments/payment_request.mojom.h" |
138 #include "components/pref_registry/pref_registry_syncable.h" | 138 #include "components/pref_registry/pref_registry_syncable.h" |
139 #include "components/prefs/pref_service.h" | 139 #include "components/prefs/pref_service.h" |
140 #include "components/prefs/scoped_user_pref_update.h" | 140 #include "components/prefs/scoped_user_pref_update.h" |
141 #include "components/rappor/public/rappor_utils.h" | 141 #include "components/rappor/public/rappor_utils.h" |
142 #include "components/rappor/rappor_recorder_impl.h" | 142 #include "components/rappor/rappor_recorder_impl.h" |
143 #include "components/rappor/rappor_service_impl.h" | 143 #include "components/rappor/rappor_service_impl.h" |
144 #include "components/safe_browsing_db/safe_browsing_prefs.h" | |
144 #include "components/security_interstitials/core/ssl_error_ui.h" | 145 #include "components/security_interstitials/core/ssl_error_ui.h" |
145 #include "components/signin/core/common/profile_management_switches.h" | 146 #include "components/signin/core/common/profile_management_switches.h" |
146 #include "components/spellcheck/spellcheck_build_features.h" | 147 #include "components/spellcheck/spellcheck_build_features.h" |
147 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" | 148 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" |
148 #include "components/task_scheduler_util/initialization/browser_util.h" | 149 #include "components/task_scheduler_util/initialization/browser_util.h" |
149 #include "components/task_scheduler_util/variations/browser_variations_util.h" | 150 #include "components/task_scheduler_util/variations/browser_variations_util.h" |
150 #include "components/translate/core/common/translate_switches.h" | 151 #include "components/translate/core/common/translate_switches.h" |
151 #include "components/url_formatter/url_fixer.h" | 152 #include "components/url_formatter/url_fixer.h" |
152 #include "components/variations/variations_associated_data.h" | 153 #include "components/variations/variations_associated_data.h" |
153 #include "components/version_info/version_info.h" | 154 #include "components/version_info/version_info.h" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 if (!render_frame_host) | 661 if (!render_frame_host) |
661 return; | 662 return; |
662 WebContents* web_contents = | 663 WebContents* web_contents = |
663 WebContents::FromRenderFrameHost(render_frame_host); | 664 WebContents::FromRenderFrameHost(render_frame_host); |
664 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, | 665 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, |
665 source_url); | 666 source_url); |
666 } | 667 } |
667 #endif // BUILDFLAG(ENABLE_PLUGINS) | 668 #endif // BUILDFLAG(ENABLE_PLUGINS) |
668 | 669 |
669 // An implementation of the SSLCertReporter interface used by | 670 // An implementation of the SSLCertReporter interface used by |
670 // SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid | 671 // SSLErrorHandler. Uses CertificateReportingService to send reports. The |
671 // certificate reports. | 672 // service handles queueing and re-sending of failed reports. Each certificate |
672 class SafeBrowsingSSLCertReporter : public SSLCertReporter { | 673 // error creates a new instance of this class. |
674 class CertificateReportingServiceCertReporter : public SSLCertReporter { | |
673 public: | 675 public: |
674 explicit SafeBrowsingSSLCertReporter( | 676 explicit CertificateReportingServiceCertReporter( |
675 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>& | 677 CertificateReportingService* service) |
676 safe_browsing_ui_manager) | 678 : service_(service) {} |
677 : safe_browsing_ui_manager_(safe_browsing_ui_manager) {} | 679 ~CertificateReportingServiceCertReporter() override {} |
678 ~SafeBrowsingSSLCertReporter() override {} | |
679 | 680 |
680 // SSLCertReporter implementation | 681 // SSLCertReporter implementation |
681 void ReportInvalidCertificateChain( | 682 void ReportInvalidCertificateChain( |
682 const std::string& serialized_report) override { | 683 const std::string& serialized_report) override { |
683 if (safe_browsing_ui_manager_) { | 684 service_->Send(serialized_report); |
684 safe_browsing_ui_manager_->ReportInvalidCertificateChain( | |
685 serialized_report, base::Bind(&base::DoNothing)); | |
686 } | |
687 } | 685 } |
688 | 686 |
689 private: | 687 private: |
690 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> | 688 CertificateReportingService* service_; |
estark
2016/12/16 23:39:04
nit: Can you add DISALLOW_COPY_AND_ASSIGN while yo
meacer
2016/12/19 23:16:45
Done.
| |
691 safe_browsing_ui_manager_; | |
692 }; | 689 }; |
693 | 690 |
694 #if BUILDFLAG(ANDROID_JAVA_UI) | 691 #if BUILDFLAG(ANDROID_JAVA_UI) |
695 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { | 692 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { |
696 WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 693 WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
697 params.render_process_id(), params.opener_render_frame_id()); | 694 params.render_process_id(), params.opener_render_frame_id()); |
698 if (!web_contents) | 695 if (!web_contents) |
699 return; | 696 return; |
700 | 697 |
701 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); | 698 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2208 // Otherwise, display an SSL blocking page. The interstitial page takes | 2205 // Otherwise, display an SSL blocking page. The interstitial page takes |
2209 // ownership of ssl_blocking_page. | 2206 // ownership of ssl_blocking_page. |
2210 int options_mask = 0; | 2207 int options_mask = 0; |
2211 if (overridable) | 2208 if (overridable) |
2212 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 2209 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
2213 if (strict_enforcement) | 2210 if (strict_enforcement) |
2214 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; | 2211 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; |
2215 if (expired_previous_decision) | 2212 if (expired_previous_decision) |
2216 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; | 2213 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; |
2217 | 2214 |
2218 safe_browsing::SafeBrowsingService* safe_browsing_service = | 2215 CertificateReportingService* cert_reporting_service = |
2219 g_browser_process->safe_browsing_service(); | 2216 CertificateReportingServiceFactory::GetForBrowserContext( |
2220 std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter( | 2217 web_contents->GetBrowserContext()); |
2221 new SafeBrowsingSSLCertReporter(safe_browsing_service | 2218 std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter( |
2222 ? safe_browsing_service->ui_manager() | 2219 new CertificateReportingServiceCertReporter(cert_reporting_service)); |
2223 : nullptr)); | 2220 |
2224 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, | 2221 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, |
2225 request_url, options_mask, | 2222 request_url, options_mask, |
2226 std::move(cert_reporter), callback); | 2223 std::move(cert_reporter), callback); |
2227 } | 2224 } |
2228 | 2225 |
2229 void ChromeContentBrowserClient::SelectClientCertificate( | 2226 void ChromeContentBrowserClient::SelectClientCertificate( |
2230 content::WebContents* web_contents, | 2227 content::WebContents* web_contents, |
2231 net::SSLCertRequestInfo* cert_request_info, | 2228 net::SSLCertRequestInfo* cert_request_info, |
2232 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 2229 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
2233 prerender::PrerenderContents* prerender_contents = | 2230 prerender::PrerenderContents* prerender_contents = |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3349 GetBrowserSchedulerWorkerPoolParamsFromVariations(); | 3346 GetBrowserSchedulerWorkerPoolParamsFromVariations(); |
3350 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: | 3347 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: |
3351 BrowserWorkerPoolIndexForTraits); | 3348 BrowserWorkerPoolIndexForTraits); |
3352 } | 3349 } |
3353 | 3350 |
3354 void ChromeContentBrowserClient:: | 3351 void ChromeContentBrowserClient:: |
3355 PerformExperimentalTaskSchedulerRedirections() { | 3352 PerformExperimentalTaskSchedulerRedirections() { |
3356 task_scheduler_util::variations:: | 3353 task_scheduler_util::variations:: |
3357 MaybePerformBrowserTaskSchedulerRedirection(); | 3354 MaybePerformBrowserTaskSchedulerRedirection(); |
3358 } | 3355 } |
OLD | NEW |