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

Side by Side Diff: chrome/browser/ssl/ssl_error_handler.h

Issue 1223233002: Common Name Mismatch Handler For WWW Subdomain Mismatch case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving Comments Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_
6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ 6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/ssl/common_name_mismatch_handler.h"
14 #include "chrome/browser/ssl/ssl_cert_reporter.h" 15 #include "chrome/browser/ssl/ssl_cert_reporter.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
18 #include "content/public/browser/web_contents_user_data.h" 19 #include "content/public/browser/web_contents_user_data.h"
19 #include "net/ssl/ssl_info.h" 20 #include "net/ssl/ssl_info.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace content { 23 namespace content {
23 class RenderViewHost; 24 class RenderViewHost;
(...skipping 30 matching lines...) Expand all
54 int options_mask, 55 int options_mask,
55 scoped_ptr<SSLCertReporter> ssl_cert_reporter, 56 scoped_ptr<SSLCertReporter> ssl_cert_reporter,
56 const base::Callback<void(bool)>& callback); 57 const base::Callback<void(bool)>& callback);
57 58
58 static void SetInterstitialDelayTypeForTest(InterstitialDelayType delay); 59 static void SetInterstitialDelayTypeForTest(InterstitialDelayType delay);
59 60
60 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback; 61 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback;
61 static void SetInterstitialTimerStartedCallbackForTest( 62 static void SetInterstitialTimerStartedCallbackForTest(
62 TimerStartedCallback* callback); 63 TimerStartedCallback* callback);
63 64
65 // Gets the result of whether the suggested url is valid. Displays
palmer 2015/07/17 00:16:00 Nit: URL, SSL. In general, make sure all your acro
Bhanu Dev 2015/07/23 20:11:06 Done.
66 // common name mismatch interstitial or ssl interstitial accordingly.
67 void CommonNameMismatchHandlerCallback(
68 const CommonNameMismatchHandler::Results& results);
69
64 protected: 70 protected:
65 SSLErrorHandler(content::WebContents* web_contents, 71 SSLErrorHandler(content::WebContents* web_contents,
66 int cert_error, 72 int cert_error,
67 const net::SSLInfo& ssl_info, 73 const net::SSLInfo& ssl_info,
68 const GURL& request_url, 74 const GURL& request_url,
69 int options_mask, 75 int options_mask,
70 scoped_ptr<SSLCertReporter> ssl_cert_reporter, 76 scoped_ptr<SSLCertReporter> ssl_cert_reporter,
71 const base::Callback<void(bool)>& callback); 77 const base::Callback<void(bool)>& callback);
72 78
73 ~SSLErrorHandler() override; 79 ~SSLErrorHandler() override;
74 80
75 // Called when an SSL cert error is encountered. Triggers a captive portal 81 // Called when an SSL cert error is encountered. Triggers a captive portal
76 // check and fires a one shot timer to wait for a "captive portal detected" 82 // check and fires a one shot timer to wait for a "captive portal detected"
77 // result to arrive. 83 // result to arrive.
78 void StartHandlingError(); 84 void StartHandlingError();
79 const base::OneShotTimer<SSLErrorHandler>& get_timer() const { 85 const base::OneShotTimer<SSLErrorHandler>& get_timer() const {
80 return timer_; 86 return timer_;
81 } 87 }
82 88
83 private: 89 private:
84 // Callback for the one-shot timer. When the timer expires, an SSL error is 90 // Callback for the one-shot timer. When the timer expires, an SSL error is
85 // immediately displayed. 91 // immediately displayed.
86 void OnTimerExpired(); 92 void OnTimerExpired();
87 93
88 // These are virtual for tests: 94 // These are virtual for tests:
89 virtual void CheckForCaptivePortal(); 95 virtual void CheckForCaptivePortal();
90 virtual void ShowCaptivePortalInterstitial(const GURL& landing_url); 96 virtual void ShowCaptivePortalInterstitial(const GURL& landing_url);
91 virtual void ShowSSLInterstitial(); 97 virtual void ShowSSLInterstitial(const GURL& suggested_url);
98 virtual bool GetSuggestedUrl(const GURL& request_url,
99 const std::vector<std::string>& dns_names,
100 GURL* suggested_url);
101 virtual void CheckSuggestedUrl(const GURL& suggested_url);
92 102
93 // content::NotificationObserver: 103 // content::NotificationObserver:
94 void Observe( 104 void Observe(
95 int type, 105 int type,
96 const content::NotificationSource& source, 106 const content::NotificationSource& source,
97 const content::NotificationDetails& details) override; 107 const content::NotificationDetails& details) override;
98 108
99 // content::WebContentsObserver: 109 // content::WebContentsObserver:
100 void DidStartNavigationToPendingEntry( 110 void DidStartNavigationToPendingEntry(
101 const GURL& url, 111 const GURL& url,
102 content::NavigationController::ReloadType reload_type) override; 112 content::NavigationController::ReloadType reload_type) override;
103 113
114 // Timer duration for common name mismatch handler url check.
115 const int common_name_handler_delay_in_seconds = 3;
116
104 content::WebContents* web_contents_; 117 content::WebContents* web_contents_;
105 const int cert_error_; 118 const int cert_error_;
106 const net::SSLInfo ssl_info_; 119 const net::SSLInfo ssl_info_;
107 const GURL request_url_; 120 const GURL request_url_;
108 const int options_mask_; 121 const int options_mask_;
109 base::Callback<void(bool)> callback_; 122 base::Callback<void(bool)> callback_;
110 123
111 content::NotificationRegistrar registrar_; 124 content::NotificationRegistrar registrar_;
112 base::OneShotTimer<SSLErrorHandler> timer_; 125 base::OneShotTimer<SSLErrorHandler> timer_;
113 126
127 scoped_ptr<CommonNameMismatchHandler> common_name_mismatch_handler_;
128
114 scoped_ptr<SSLCertReporter> ssl_cert_reporter_; 129 scoped_ptr<SSLCertReporter> ssl_cert_reporter_;
115 130
116 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); 131 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler);
117 }; 132 };
118 133
119 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ 134 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698