| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "chrome/browser/prerender/prerender_manager.h" | 66 #include "chrome/browser/prerender/prerender_manager.h" |
| 67 #include "chrome/browser/prerender/prerender_manager_factory.h" | 67 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 68 #include "chrome/browser/prerender/prerender_message_filter.h" | 68 #include "chrome/browser/prerender/prerender_message_filter.h" |
| 69 #include "chrome/browser/printing/printing_message_filter.h" | 69 #include "chrome/browser/printing/printing_message_filter.h" |
| 70 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 70 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 71 #include "chrome/browser/profiles/profile.h" | 71 #include "chrome/browser/profiles/profile.h" |
| 72 #include "chrome/browser/profiles/profile_io_data.h" | 72 #include "chrome/browser/profiles/profile_io_data.h" |
| 73 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" | 73 #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" |
| 74 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 74 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 75 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" | 75 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" |
| 76 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 76 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
| 77 #include "chrome/browser/safe_browsing/ui_manager.h" | 77 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
| 78 #include "chrome/browser/search/instant_service.h" | 78 #include "chrome/browser/search/instant_service.h" |
| 79 #include "chrome/browser/search/instant_service_factory.h" | 79 #include "chrome/browser/search/instant_service_factory.h" |
| 80 #include "chrome/browser/search/search.h" | 80 #include "chrome/browser/search/search.h" |
| 81 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 81 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
| 82 #include "chrome/browser/speech/tts_controller.h" | 82 #include "chrome/browser/speech/tts_controller.h" |
| 83 #include "chrome/browser/speech/tts_message_filter.h" | 83 #include "chrome/browser/speech/tts_message_filter.h" |
| 84 #include "chrome/browser/ssl/ssl_blocking_page.h" | 84 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 85 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 85 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| 86 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 86 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
| 87 #include "chrome/browser/ssl/ssl_error_handler.h" | 87 #include "chrome/browser/ssl/ssl_error_handler.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 #include "components/nacl/common/nacl_constants.h" | 137 #include "components/nacl/common/nacl_constants.h" |
| 138 #include "components/net_log/chrome_net_log.h" | 138 #include "components/net_log/chrome_net_log.h" |
| 139 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 139 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
| 140 #include "components/payments/payment_request.mojom.h" | 140 #include "components/payments/payment_request.mojom.h" |
| 141 #include "components/pref_registry/pref_registry_syncable.h" | 141 #include "components/pref_registry/pref_registry_syncable.h" |
| 142 #include "components/prefs/pref_service.h" | 142 #include "components/prefs/pref_service.h" |
| 143 #include "components/prefs/scoped_user_pref_update.h" | 143 #include "components/prefs/scoped_user_pref_update.h" |
| 144 #include "components/rappor/public/rappor_utils.h" | 144 #include "components/rappor/public/rappor_utils.h" |
| 145 #include "components/rappor/rappor_recorder_impl.h" | 145 #include "components/rappor/rappor_recorder_impl.h" |
| 146 #include "components/rappor/rappor_service_impl.h" | 146 #include "components/rappor/rappor_service_impl.h" |
| 147 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 147 #include "components/security_interstitials/core/ssl_error_ui.h" | 148 #include "components/security_interstitials/core/ssl_error_ui.h" |
| 148 #include "components/signin/core/common/profile_management_switches.h" | 149 #include "components/signin/core/common/profile_management_switches.h" |
| 149 #include "components/spellcheck/spellcheck_build_features.h" | 150 #include "components/spellcheck/spellcheck_build_features.h" |
| 150 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" | 151 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" |
| 151 #include "components/task_scheduler_util/initialization/browser_util.h" | 152 #include "components/task_scheduler_util/initialization/browser_util.h" |
| 152 #include "components/task_scheduler_util/variations/browser_variations_util.h" | 153 #include "components/task_scheduler_util/variations/browser_variations_util.h" |
| 153 #include "components/translate/core/common/translate_switches.h" | 154 #include "components/translate/core/common/translate_switches.h" |
| 154 #include "components/url_formatter/url_fixer.h" | 155 #include "components/url_formatter/url_fixer.h" |
| 155 #include "components/variations/variations_associated_data.h" | 156 #include "components/variations/variations_associated_data.h" |
| 156 #include "components/version_info/version_info.h" | 157 #include "components/version_info/version_info.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 if (!render_frame_host) | 665 if (!render_frame_host) |
| 665 return; | 666 return; |
| 666 WebContents* web_contents = | 667 WebContents* web_contents = |
| 667 WebContents::FromRenderFrameHost(render_frame_host); | 668 WebContents::FromRenderFrameHost(render_frame_host); |
| 668 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, | 669 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, |
| 669 source_url); | 670 source_url); |
| 670 } | 671 } |
| 671 #endif // BUILDFLAG(ENABLE_PLUGINS) | 672 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 672 | 673 |
| 673 // An implementation of the SSLCertReporter interface used by | 674 // An implementation of the SSLCertReporter interface used by |
| 674 // SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid | 675 // SSLErrorHandler. Uses CertificateReportingService to send reports. The |
| 675 // certificate reports. | 676 // service handles queueing and re-sending of failed reports. Each certificate |
| 676 class SafeBrowsingSSLCertReporter : public SSLCertReporter { | 677 // error creates a new instance of this class. |
| 678 class CertificateReportingServiceCertReporter : public SSLCertReporter { |
| 677 public: | 679 public: |
| 678 explicit SafeBrowsingSSLCertReporter( | 680 explicit CertificateReportingServiceCertReporter( |
| 679 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>& | 681 CertificateReportingService* service) |
| 680 safe_browsing_ui_manager) | 682 : service_(service) {} |
| 681 : safe_browsing_ui_manager_(safe_browsing_ui_manager) {} | 683 ~CertificateReportingServiceCertReporter() override {} |
| 682 ~SafeBrowsingSSLCertReporter() override {} | |
| 683 | 684 |
| 684 // SSLCertReporter implementation | 685 // SSLCertReporter implementation |
| 685 void ReportInvalidCertificateChain( | 686 void ReportInvalidCertificateChain( |
| 686 const std::string& serialized_report) override { | 687 const std::string& serialized_report) override { |
| 687 if (safe_browsing_ui_manager_) { | 688 service_->Send(serialized_report); |
| 688 safe_browsing_ui_manager_->ReportInvalidCertificateChain( | |
| 689 serialized_report, base::Bind(&base::DoNothing)); | |
| 690 } | |
| 691 } | 689 } |
| 692 | 690 |
| 693 private: | 691 private: |
| 694 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> | 692 CertificateReportingService* service_; |
| 695 safe_browsing_ui_manager_; | 693 |
| 694 DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceCertReporter); |
| 696 }; | 695 }; |
| 697 | 696 |
| 698 #if BUILDFLAG(ANDROID_JAVA_UI) | 697 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 699 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { | 698 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { |
| 700 WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 699 WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
| 701 params.render_process_id(), params.opener_render_frame_id()); | 700 params.render_process_id(), params.opener_render_frame_id()); |
| 702 if (!web_contents) | 701 if (!web_contents) |
| 703 return; | 702 return; |
| 704 | 703 |
| 705 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); | 704 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 // Otherwise, display an SSL blocking page. The interstitial page takes | 2193 // Otherwise, display an SSL blocking page. The interstitial page takes |
| 2195 // ownership of ssl_blocking_page. | 2194 // ownership of ssl_blocking_page. |
| 2196 int options_mask = 0; | 2195 int options_mask = 0; |
| 2197 if (overridable) | 2196 if (overridable) |
| 2198 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 2197 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 2199 if (strict_enforcement) | 2198 if (strict_enforcement) |
| 2200 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; | 2199 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; |
| 2201 if (expired_previous_decision) | 2200 if (expired_previous_decision) |
| 2202 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; | 2201 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; |
| 2203 | 2202 |
| 2204 safe_browsing::SafeBrowsingService* safe_browsing_service = | 2203 CertificateReportingService* cert_reporting_service = |
| 2205 g_browser_process->safe_browsing_service(); | 2204 CertificateReportingServiceFactory::GetForBrowserContext( |
| 2206 std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter( | 2205 web_contents->GetBrowserContext()); |
| 2207 new SafeBrowsingSSLCertReporter(safe_browsing_service | 2206 std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter( |
| 2208 ? safe_browsing_service->ui_manager() | 2207 new CertificateReportingServiceCertReporter(cert_reporting_service)); |
| 2209 : nullptr)); | 2208 |
| 2210 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, | 2209 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, |
| 2211 request_url, options_mask, | 2210 request_url, options_mask, |
| 2212 std::move(cert_reporter), callback); | 2211 std::move(cert_reporter), callback); |
| 2213 } | 2212 } |
| 2214 | 2213 |
| 2215 void ChromeContentBrowserClient::SelectClientCertificate( | 2214 void ChromeContentBrowserClient::SelectClientCertificate( |
| 2216 content::WebContents* web_contents, | 2215 content::WebContents* web_contents, |
| 2217 net::SSLCertRequestInfo* cert_request_info, | 2216 net::SSLCertRequestInfo* cert_request_info, |
| 2218 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 2217 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
| 2219 prerender::PrerenderContents* prerender_contents = | 2218 prerender::PrerenderContents* prerender_contents = |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3376 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { | 3375 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { |
| 3377 return variations::GetVariationParamValue( | 3376 return variations::GetVariationParamValue( |
| 3378 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; | 3377 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; |
| 3379 } | 3378 } |
| 3380 | 3379 |
| 3381 bool ChromeContentBrowserClient:: | 3380 bool ChromeContentBrowserClient:: |
| 3382 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3381 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
| 3383 return variations::GetVariationParamValue( | 3382 return variations::GetVariationParamValue( |
| 3384 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3383 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
| 3385 } | 3384 } |
| OLD | NEW |