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

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

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Fix metrics provider - based on crrev.com/2531023002 Created 3 years, 12 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "chrome/browser/prerender/prerender_manager.h" 64 #include "chrome/browser/prerender/prerender_manager.h"
65 #include "chrome/browser/prerender/prerender_manager_factory.h" 65 #include "chrome/browser/prerender/prerender_manager_factory.h"
66 #include "chrome/browser/prerender/prerender_message_filter.h" 66 #include "chrome/browser/prerender/prerender_message_filter.h"
67 #include "chrome/browser/printing/printing_message_filter.h" 67 #include "chrome/browser/printing/printing_message_filter.h"
68 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" 68 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
69 #include "chrome/browser/profiles/profile.h" 69 #include "chrome/browser/profiles/profile.h"
70 #include "chrome/browser/profiles/profile_io_data.h" 70 #include "chrome/browser/profiles/profile_io_data.h"
71 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" 71 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h"
72 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 72 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
73 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" 73 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h"
74 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 74 #include "chrome/browser/safe_browsing/certificate_reporting_service.h"
75 #include "chrome/browser/safe_browsing/ui_manager.h" 75 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h"
76 #include "chrome/browser/search/instant_service.h" 76 #include "chrome/browser/search/instant_service.h"
77 #include "chrome/browser/search/instant_service_factory.h" 77 #include "chrome/browser/search/instant_service_factory.h"
78 #include "chrome/browser/search/search.h" 78 #include "chrome/browser/search/search.h"
79 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" 79 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
80 #include "chrome/browser/speech/tts_controller.h" 80 #include "chrome/browser/speech/tts_controller.h"
81 #include "chrome/browser/speech/tts_message_filter.h" 81 #include "chrome/browser/speech/tts_message_filter.h"
82 #include "chrome/browser/ssl/ssl_blocking_page.h" 82 #include "chrome/browser/ssl/ssl_blocking_page.h"
83 #include "chrome/browser/ssl/ssl_cert_reporter.h" 83 #include "chrome/browser/ssl/ssl_cert_reporter.h"
84 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" 84 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
85 #include "chrome/browser/ssl/ssl_error_handler.h" 85 #include "chrome/browser/ssl/ssl_error_handler.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 if (!render_frame_host) 663 if (!render_frame_host)
663 return; 664 return;
664 WebContents* web_contents = 665 WebContents* web_contents =
665 WebContents::FromRenderFrameHost(render_frame_host); 666 WebContents::FromRenderFrameHost(render_frame_host);
666 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, 667 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents,
667 source_url); 668 source_url);
668 } 669 }
669 #endif // BUILDFLAG(ENABLE_PLUGINS) 670 #endif // BUILDFLAG(ENABLE_PLUGINS)
670 671
671 // An implementation of the SSLCertReporter interface used by 672 // An implementation of the SSLCertReporter interface used by
672 // SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid 673 // SSLErrorHandler. Uses CertificateReportingService to send reports. The
673 // certificate reports. 674 // service handles queueing and re-sending of failed reports. Each certificate
674 class SafeBrowsingSSLCertReporter : public SSLCertReporter { 675 // error creates a new instance of this class.
676 class CertificateReportingServiceCertReporter : public SSLCertReporter {
675 public: 677 public:
676 explicit SafeBrowsingSSLCertReporter( 678 explicit CertificateReportingServiceCertReporter(
677 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>& 679 CertificateReportingService* service)
678 safe_browsing_ui_manager) 680 : service_(service) {}
679 : safe_browsing_ui_manager_(safe_browsing_ui_manager) {} 681 ~CertificateReportingServiceCertReporter() override {}
680 ~SafeBrowsingSSLCertReporter() override {}
681 682
682 // SSLCertReporter implementation 683 // SSLCertReporter implementation
683 void ReportInvalidCertificateChain( 684 void ReportInvalidCertificateChain(
684 const std::string& serialized_report) override { 685 const std::string& serialized_report) override {
685 if (safe_browsing_ui_manager_) { 686 service_->Send(serialized_report);
686 safe_browsing_ui_manager_->ReportInvalidCertificateChain(
687 serialized_report, base::Bind(&base::DoNothing));
688 }
689 } 687 }
690 688
691 private: 689 private:
692 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> 690 CertificateReportingService* service_;
693 safe_browsing_ui_manager_; 691
692 DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceCertReporter);
694 }; 693 };
695 694
696 #if BUILDFLAG(ANDROID_JAVA_UI) 695 #if BUILDFLAG(ANDROID_JAVA_UI)
697 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { 696 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) {
698 WebContents* web_contents = tab_util::GetWebContentsByFrameID( 697 WebContents* web_contents = tab_util::GetWebContentsByFrameID(
699 params.render_process_id(), params.opener_render_frame_id()); 698 params.render_process_id(), params.opener_render_frame_id());
700 if (!web_contents) 699 if (!web_contents)
701 return; 700 return;
702 701
703 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); 702 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params);
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 // Otherwise, display an SSL blocking page. The interstitial page takes 2216 // Otherwise, display an SSL blocking page. The interstitial page takes
2218 // ownership of ssl_blocking_page. 2217 // ownership of ssl_blocking_page.
2219 int options_mask = 0; 2218 int options_mask = 0;
2220 if (overridable) 2219 if (overridable)
2221 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; 2220 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED;
2222 if (strict_enforcement) 2221 if (strict_enforcement)
2223 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; 2222 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT;
2224 if (expired_previous_decision) 2223 if (expired_previous_decision)
2225 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; 2224 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED;
2226 2225
2227 safe_browsing::SafeBrowsingService* safe_browsing_service = 2226 CertificateReportingService* cert_reporting_service =
2228 g_browser_process->safe_browsing_service(); 2227 CertificateReportingServiceFactory::GetForBrowserContext(
2229 std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter( 2228 web_contents->GetBrowserContext());
2230 new SafeBrowsingSSLCertReporter(safe_browsing_service 2229 std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter(
2231 ? safe_browsing_service->ui_manager() 2230 new CertificateReportingServiceCertReporter(cert_reporting_service));
2232 : nullptr)); 2231
2233 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, 2232 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info,
2234 request_url, options_mask, 2233 request_url, options_mask,
2235 std::move(cert_reporter), callback); 2234 std::move(cert_reporter), callback);
2236 } 2235 }
2237 2236
2238 void ChromeContentBrowserClient::SelectClientCertificate( 2237 void ChromeContentBrowserClient::SelectClientCertificate(
2239 content::WebContents* web_contents, 2238 content::WebContents* web_contents,
2240 net::SSLCertRequestInfo* cert_request_info, 2239 net::SSLCertRequestInfo* cert_request_info,
2241 std::unique_ptr<content::ClientCertificateDelegate> delegate) { 2240 std::unique_ptr<content::ClientCertificateDelegate> delegate) {
2242 prerender::PrerenderContents* prerender_contents = 2241 prerender::PrerenderContents* prerender_contents =
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3378 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3380 return variations::GetVariationParamValue( 3379 return variations::GetVariationParamValue(
3381 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3380 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3382 } 3381 }
3383 3382
3384 // static 3383 // static
3385 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 3384 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
3386 const storage::QuotaSettings* settings) { 3385 const storage::QuotaSettings* settings) {
3387 g_default_quota_settings = settings; 3386 g_default_quota_settings = settings;
3388 } 3387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698