| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/certificate_reporting_service.h" |
| 75 #include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h" |
| 74 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 76 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 75 #include "chrome/browser/safe_browsing/ui_manager.h" | 77 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 76 #include "chrome/browser/search/instant_service.h" | 78 #include "chrome/browser/search/instant_service.h" |
| 77 #include "chrome/browser/search/instant_service_factory.h" | 79 #include "chrome/browser/search/instant_service_factory.h" |
| 78 #include "chrome/browser/search/search.h" | 80 #include "chrome/browser/search/search.h" |
| 79 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 81 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
| 80 #include "chrome/browser/speech/tts_controller.h" | 82 #include "chrome/browser/speech/tts_controller.h" |
| 81 #include "chrome/browser/speech/tts_message_filter.h" | 83 #include "chrome/browser/speech/tts_message_filter.h" |
| 82 #include "chrome/browser/ssl/ssl_blocking_page.h" | 84 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 83 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 85 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 #include "components/metrics/call_stack_profile_collector.h" | 133 #include "components/metrics/call_stack_profile_collector.h" |
| 132 #include "components/metrics/client_info.h" | 134 #include "components/metrics/client_info.h" |
| 133 #include "components/net_log/chrome_net_log.h" | 135 #include "components/net_log/chrome_net_log.h" |
| 134 #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" |
| 135 #include "components/payments/payment_request.mojom.h" | 137 #include "components/payments/payment_request.mojom.h" |
| 136 #include "components/pref_registry/pref_registry_syncable.h" | 138 #include "components/pref_registry/pref_registry_syncable.h" |
| 137 #include "components/prefs/pref_service.h" | 139 #include "components/prefs/pref_service.h" |
| 138 #include "components/prefs/scoped_user_pref_update.h" | 140 #include "components/prefs/scoped_user_pref_update.h" |
| 139 #include "components/rappor/rappor_recorder_impl.h" | 141 #include "components/rappor/rappor_recorder_impl.h" |
| 140 #include "components/rappor/rappor_utils.h" | 142 #include "components/rappor/rappor_utils.h" |
| 143 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 141 #include "components/security_interstitials/core/ssl_error_ui.h" | 144 #include "components/security_interstitials/core/ssl_error_ui.h" |
| 142 #include "components/signin/core/common/profile_management_switches.h" | 145 #include "components/signin/core/common/profile_management_switches.h" |
| 143 #include "components/spellcheck/spellcheck_build_features.h" | 146 #include "components/spellcheck/spellcheck_build_features.h" |
| 144 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" | 147 #include "components/startup_metric_utils/browser/startup_metric_host_impl.h" |
| 145 #include "components/translate/core/common/translate_switches.h" | 148 #include "components/translate/core/common/translate_switches.h" |
| 146 #include "components/url_formatter/url_fixer.h" | 149 #include "components/url_formatter/url_fixer.h" |
| 147 #include "components/variations/variations_associated_data.h" | 150 #include "components/variations/variations_associated_data.h" |
| 148 #include "components/version_info/version_info.h" | 151 #include "components/version_info/version_info.h" |
| 149 #include "content/public/browser/browser_child_process_host.h" | 152 #include "content/public/browser/browser_child_process_host.h" |
| 150 #include "content/public/browser/browser_main_parts.h" | 153 #include "content/public/browser/browser_main_parts.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (!render_frame_host) | 656 if (!render_frame_host) |
| 654 return; | 657 return; |
| 655 WebContents* web_contents = | 658 WebContents* web_contents = |
| 656 WebContents::FromRenderFrameHost(render_frame_host); | 659 WebContents::FromRenderFrameHost(render_frame_host); |
| 657 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, | 660 FlashDownloadInterception::InterceptFlashDownloadNavigation(web_contents, |
| 658 source_url); | 661 source_url); |
| 659 } | 662 } |
| 660 #endif // BUILDFLAG(ENABLE_PLUGINS) | 663 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 661 | 664 |
| 662 // An implementation of the SSLCertReporter interface used by | 665 // An implementation of the SSLCertReporter interface used by |
| 663 // SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid | 666 // SSLErrorHandler. Uses CertificateReportingService to send reports. The |
| 664 // certificate reports. | 667 // service handles queueing and re-sending of failed reports. Each certificate |
| 665 class SafeBrowsingSSLCertReporter : public SSLCertReporter { | 668 // error creates a new instance of this class. |
| 669 class CertificateReportingServiceCertReporter : public SSLCertReporter { |
| 666 public: | 670 public: |
| 667 explicit SafeBrowsingSSLCertReporter( | 671 explicit CertificateReportingServiceCertReporter( |
| 668 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>& | 672 CertificateReportingService* service) |
| 669 safe_browsing_ui_manager) | 673 : service_(service) {} |
| 670 : safe_browsing_ui_manager_(safe_browsing_ui_manager) {} | 674 ~CertificateReportingServiceCertReporter() override {} |
| 671 ~SafeBrowsingSSLCertReporter() override {} | |
| 672 | 675 |
| 673 // SSLCertReporter methods: | 676 // SSLCertReporter methods: |
| 674 void ReportInvalidCertificateChain( | 677 void ReportInvalidCertificateChain( |
| 675 const std::string& serialized_report) override { | 678 const std::string& serialized_report) override { |
| 676 if (safe_browsing_ui_manager_) { | 679 service_->Send(serialized_report); |
| 677 safe_browsing_ui_manager_->ReportInvalidCertificateChain( | |
| 678 serialized_report, base::Bind(&base::DoNothing)); | |
| 679 } | |
| 680 } | 680 } |
| 681 void OnDidNotSendReport() override {} | 681 void OnDidNotSendReport() override { service_->DidAttemptSend(false); } |
| 682 | 682 |
| 683 private: | 683 private: |
| 684 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> | 684 CertificateReportingService* service_; |
| 685 safe_browsing_ui_manager_; | |
| 686 }; | 685 }; |
| 687 | 686 |
| 688 #if BUILDFLAG(ANDROID_JAVA_UI) | 687 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 689 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { | 688 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { |
| 690 WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 689 WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
| 691 params.render_process_id(), params.opener_render_frame_id()); | 690 params.render_process_id(), params.opener_render_frame_id()); |
| 692 if (!web_contents) | 691 if (!web_contents) |
| 693 return; | 692 return; |
| 694 | 693 |
| 695 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); | 694 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 // Otherwise, display an SSL blocking page. The interstitial page takes | 2195 // Otherwise, display an SSL blocking page. The interstitial page takes |
| 2197 // ownership of ssl_blocking_page. | 2196 // ownership of ssl_blocking_page. |
| 2198 int options_mask = 0; | 2197 int options_mask = 0; |
| 2199 if (overridable) | 2198 if (overridable) |
| 2200 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 2199 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 2201 if (strict_enforcement) | 2200 if (strict_enforcement) |
| 2202 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; | 2201 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; |
| 2203 if (expired_previous_decision) | 2202 if (expired_previous_decision) |
| 2204 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; | 2203 options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED; |
| 2205 | 2204 |
| 2206 safe_browsing::SafeBrowsingService* safe_browsing_service = | 2205 // safe_browsing::SafeBrowsingService* safe_browsing_service = |
| 2207 g_browser_process->safe_browsing_service(); | 2206 // g_browser_process->safe_browsing_service(); |
| 2208 std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter( | 2207 CertificateReportingService* cert_reporting_service = |
| 2209 new SafeBrowsingSSLCertReporter(safe_browsing_service | 2208 CertificateReportingServiceFactory::GetForBrowserContext( |
| 2210 ? safe_browsing_service->ui_manager() | 2209 web_contents->GetBrowserContext()); |
| 2211 : nullptr)); | 2210 |
| 2211 /*if (!cert_reporting_service->IsInitialized()) { |
| 2212 Profile* profile = |
| 2213 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 2214 SafeBrowsingPreferenceObserver* observer = |
| 2215 new SafeBrowsingPreferenceObserver(*profile->GetPrefs(), |
| 2216 safe_browsing_service, |
| 2217 cert_reporting_service); |
| 2218 // Initialize cert reporting service and subscribe it to SafeBrowsing |
| 2219 // shutdown notifications. |
| 2220 cert_reporting_service->Initialize( |
| 2221 std::unique_ptr<SafeBrowsingPreferenceObserver>(observer), |
| 2222 safe_browsing_service->url_request_context(), |
| 2223 safe_browsing_service->RegisterShutdownCallback( |
| 2224 base::Bind(&CertificateReportingService::Shutdown, |
| 2225 base::Unretained(cert_reporting_service)))); |
| 2226 }*/ |
| 2227 |
| 2228 std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter( |
| 2229 new CertificateReportingServiceCertReporter(cert_reporting_service)); |
| 2212 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, | 2230 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, |
| 2213 request_url, options_mask, | 2231 request_url, options_mask, |
| 2214 std::move(cert_reporter), callback); | 2232 std::move(cert_reporter), callback); |
| 2215 } | 2233 } |
| 2216 | 2234 |
| 2217 void ChromeContentBrowserClient::SelectClientCertificate( | 2235 void ChromeContentBrowserClient::SelectClientCertificate( |
| 2218 content::WebContents* web_contents, | 2236 content::WebContents* web_contents, |
| 2219 net::SSLCertRequestInfo* cert_request_info, | 2237 net::SSLCertRequestInfo* cert_request_info, |
| 2220 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 2238 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
| 2221 prerender::PrerenderContents* prerender_contents = | 2239 prerender::PrerenderContents* prerender_contents = |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3300 render_frame_host, std::move(source), std::move(request)); | 3318 render_frame_host, std::move(source), std::move(request)); |
| 3301 #else | 3319 #else |
| 3302 // Chrome's media remoting implementation depends on the Media Router | 3320 // Chrome's media remoting implementation depends on the Media Router |
| 3303 // infrastructure to identify remote sinks and provide the user interface for | 3321 // infrastructure to identify remote sinks and provide the user interface for |
| 3304 // sink selection. In the case where the Media Router is not present, simply | 3322 // sink selection. In the case where the Media Router is not present, simply |
| 3305 // drop the interface request. This will prevent code paths for media remoting | 3323 // drop the interface request. This will prevent code paths for media remoting |
| 3306 // in the renderer process from activating. | 3324 // in the renderer process from activating. |
| 3307 #endif | 3325 #endif |
| 3308 } | 3326 } |
| 3309 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) | 3327 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
| OLD | NEW |