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

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

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/certificate_reporting_service.h"
76 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h"
75 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 77 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
estark 2016/12/16 01:57:58 can be removed now?
meacer 2016/12/16 20:26:35 Done.
76 #include "chrome/browser/safe_browsing/ui_manager.h" 78 #include "chrome/browser/safe_browsing/ui_manager.h"
estark 2016/12/16 01:57:58 ditto
meacer 2016/12/16 20:26:35 Done.
77 #include "chrome/browser/search/instant_service.h" 79 #include "chrome/browser/search/instant_service.h"
78 #include "chrome/browser/search/instant_service_factory.h" 80 #include "chrome/browser/search/instant_service_factory.h"
79 #include "chrome/browser/search/search.h" 81 #include "chrome/browser/search/search.h"
80 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" 82 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
81 #include "chrome/browser/speech/tts_controller.h" 83 #include "chrome/browser/speech/tts_controller.h"
82 #include "chrome/browser/speech/tts_message_filter.h" 84 #include "chrome/browser/speech/tts_message_filter.h"
83 #include "chrome/browser/ssl/ssl_blocking_page.h" 85 #include "chrome/browser/ssl/ssl_blocking_page.h"
84 #include "chrome/browser/ssl/ssl_cert_reporter.h" 86 #include "chrome/browser/ssl/ssl_cert_reporter.h"
85 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" 87 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
86 #include "chrome/browser/ssl/ssl_error_handler.h" 88 #include "chrome/browser/ssl/ssl_error_handler.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #include "components/metrics/client_info.h" 136 #include "components/metrics/client_info.h"
135 #include "components/net_log/chrome_net_log.h" 137 #include "components/net_log/chrome_net_log.h"
136 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" 138 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
137 #include "components/payments/payment_request.mojom.h" 139 #include "components/payments/payment_request.mojom.h"
138 #include "components/pref_registry/pref_registry_syncable.h" 140 #include "components/pref_registry/pref_registry_syncable.h"
139 #include "components/prefs/pref_service.h" 141 #include "components/prefs/pref_service.h"
140 #include "components/prefs/scoped_user_pref_update.h" 142 #include "components/prefs/scoped_user_pref_update.h"
141 #include "components/rappor/public/rappor_utils.h" 143 #include "components/rappor/public/rappor_utils.h"
142 #include "components/rappor/rappor_recorder_impl.h" 144 #include "components/rappor/rappor_recorder_impl.h"
143 #include "components/rappor/rappor_service_impl.h" 145 #include "components/rappor/rappor_service_impl.h"
146 #include "components/safe_browsing_db/safe_browsing_prefs.h"
144 #include "components/security_interstitials/core/ssl_error_ui.h" 147 #include "components/security_interstitials/core/ssl_error_ui.h"
145 #include "components/signin/core/common/profile_management_switches.h" 148 #include "components/signin/core/common/profile_management_switches.h"
146 #include "components/spellcheck/spellcheck_build_features.h" 149 #include "components/spellcheck/spellcheck_build_features.h"
147 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" 150 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h"
148 #include "components/task_scheduler_util/initialization/browser_util.h" 151 #include "components/task_scheduler_util/initialization/browser_util.h"
149 #include "components/task_scheduler_util/variations/browser_variations_util.h" 152 #include "components/task_scheduler_util/variations/browser_variations_util.h"
150 #include "components/translate/core/common/translate_switches.h" 153 #include "components/translate/core/common/translate_switches.h"
151 #include "components/url_formatter/url_fixer.h" 154 #include "components/url_formatter/url_fixer.h"
152 #include "components/variations/variations_associated_data.h" 155 #include "components/variations/variations_associated_data.h"
153 #include "components/version_info/version_info.h" 156 #include "components/version_info/version_info.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 if (!render_frame_host) 663 if (!render_frame_host)
661 return; 664 return;
662 WebContents* web_contents = 665 WebContents* web_contents =
663 WebContents::FromRenderFrameHost(render_frame_host); 666 WebContents::FromRenderFrameHost(render_frame_host);
664 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, 667 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents,
665 source_url); 668 source_url);
666 } 669 }
667 #endif // BUILDFLAG(ENABLE_PLUGINS) 670 #endif // BUILDFLAG(ENABLE_PLUGINS)
668 671
669 // An implementation of the SSLCertReporter interface used by 672 // An implementation of the SSLCertReporter interface used by
670 // SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid 673 // SSLErrorHandler. Uses CertificateReportingService to send reports. The
671 // certificate reports. 674 // service handles queueing and re-sending of failed reports. Each certificate
672 class SafeBrowsingSSLCertReporter : public SSLCertReporter { 675 // error creates a new instance of this class.
676 class CertificateReportingServiceCertReporter : public SSLCertReporter {
estark 2016/12/16 01:57:58 Hrmmmmm. There is not much reason for this SSLCert
meacer 2016/12/16 20:26:35 I've been avoiding adding more c/b/sb dependency t
estark 2016/12/16 23:39:03 I think removing the safe_browsing_db ones would b
673 public: 677 public:
674 explicit SafeBrowsingSSLCertReporter( 678 explicit CertificateReportingServiceCertReporter(
675 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>& 679 CertificateReportingService* service)
676 safe_browsing_ui_manager) 680 : service_(service) {}
677 : safe_browsing_ui_manager_(safe_browsing_ui_manager) {} 681 ~CertificateReportingServiceCertReporter() override {}
678 ~SafeBrowsingSSLCertReporter() override {}
679 682
680 // SSLCertReporter implementation 683 // SSLCertReporter implementation
681 void ReportInvalidCertificateChain( 684 void ReportInvalidCertificateChain(
682 const std::string& serialized_report) override { 685 const std::string& serialized_report) override {
683 if (safe_browsing_ui_manager_) { 686 service_->Send(serialized_report);
684 safe_browsing_ui_manager_->ReportInvalidCertificateChain(
685 serialized_report, base::Bind(&base::DoNothing));
686 }
687 } 687 }
688 688
689 private: 689 private:
690 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> 690 CertificateReportingService* service_;
691 safe_browsing_ui_manager_;
692 }; 691 };
693 692
694 #if BUILDFLAG(ANDROID_JAVA_UI) 693 #if BUILDFLAG(ANDROID_JAVA_UI)
695 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { 694 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) {
696 WebContents* web_contents = tab_util::GetWebContentsByFrameID( 695 WebContents* web_contents = tab_util::GetWebContentsByFrameID(
697 params.render_process_id(), params.opener_render_frame_id()); 696 params.render_process_id(), params.opener_render_frame_id());
698 if (!web_contents) 697 if (!web_contents)
699 return; 698 return;
700 699
701 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); 700 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params);
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 // Otherwise, display an SSL blocking page. The interstitial page takes 2207 // Otherwise, display an SSL blocking page. The interstitial page takes
2209 // ownership of ssl_blocking_page. 2208 // ownership of ssl_blocking_page.
2210 int options_mask = 0; 2209 int options_mask = 0;
2211 if (overridable) 2210 if (overridable)
2212 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; 2211 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED;
2213 if (strict_enforcement) 2212 if (strict_enforcement)
2214 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; 2213 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT;
2215 if (expired_previous_decision) 2214 if (expired_previous_decision)
2216 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; 2215 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED;
2217 2216
2218 safe_browsing::SafeBrowsingService* safe_browsing_service = 2217 CertificateReportingService* cert_reporting_service =
2219 g_browser_process->safe_browsing_service(); 2218 CertificateReportingServiceFactory::GetForBrowserContext(
2220 std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter( 2219 web_contents->GetBrowserContext());
2221 new SafeBrowsingSSLCertReporter(safe_browsing_service 2220 std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter(
2222 ? safe_browsing_service->ui_manager() 2221 new CertificateReportingServiceCertReporter(cert_reporting_service));
2223 : nullptr)); 2222
2224 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, 2223 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info,
2225 request_url, options_mask, 2224 request_url, options_mask,
2226 std::move(cert_reporter), callback); 2225 std::move(cert_reporter), callback);
2227 } 2226 }
2228 2227
2229 void ChromeContentBrowserClient::SelectClientCertificate( 2228 void ChromeContentBrowserClient::SelectClientCertificate(
2230 content::WebContents* web_contents, 2229 content::WebContents* web_contents,
2231 net::SSLCertRequestInfo* cert_request_info, 2230 net::SSLCertRequestInfo* cert_request_info,
2232 std::unique_ptr<content::ClientCertificateDelegate> delegate) { 2231 std::unique_ptr<content::ClientCertificateDelegate> delegate) {
2233 prerender::PrerenderContents* prerender_contents = 2232 prerender::PrerenderContents* prerender_contents =
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3349 GetBrowserSchedulerWorkerPoolParamsFromVariations(); 3348 GetBrowserSchedulerWorkerPoolParamsFromVariations();
3350 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: 3349 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization::
3351 BrowserWorkerPoolIndexForTraits); 3350 BrowserWorkerPoolIndexForTraits);
3352 } 3351 }
3353 3352
3354 void ChromeContentBrowserClient:: 3353 void ChromeContentBrowserClient::
3355 PerformExperimentalTaskSchedulerRedirections() { 3354 PerformExperimentalTaskSchedulerRedirections() {
3356 task_scheduler_util::variations:: 3355 task_scheduler_util::variations::
3357 MaybePerformBrowserTaskSchedulerRedirection(); 3356 MaybePerformBrowserTaskSchedulerRedirection();
3358 } 3357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698