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

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: Changing function signature in unnittest file 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 // This method gets the result of whether the suggested url is valid. Displays
meacer 2015/07/09 17:58:56 nit: Drop "This method "
Bhanu Dev 2015/07/11 04:00:43 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);
92 98
93 // content::NotificationObserver: 99 // content::NotificationObserver:
94 void Observe( 100 void Observe(
95 int type, 101 int type,
96 const content::NotificationSource& source, 102 const content::NotificationSource& source,
97 const content::NotificationDetails& details) override; 103 const content::NotificationDetails& details) override;
98 104
99 // content::WebContentsObserver: 105 // content::WebContentsObserver:
100 void DidStartNavigationToPendingEntry( 106 void DidStartNavigationToPendingEntry(
101 const GURL& url, 107 const GURL& url,
102 content::NavigationController::ReloadType reload_type) override; 108 content::NavigationController::ReloadType reload_type) override;
103 109
110 // Timer duration for common name mismatch handler url check.
111 const int common_name_handler_delay_in_seconds = 3;
meacer 2015/07/09 17:58:56 You'll need a non-const value for this so that you
Bhanu Dev 2015/07/11 04:00:43 Done.
112
104 content::WebContents* web_contents_; 113 content::WebContents* web_contents_;
105 const int cert_error_; 114 const int cert_error_;
106 const net::SSLInfo ssl_info_; 115 const net::SSLInfo ssl_info_;
107 const GURL request_url_; 116 const GURL request_url_;
108 const int options_mask_; 117 const int options_mask_;
109 base::Callback<void(bool)> callback_; 118 base::Callback<void(bool)> callback_;
110 119
111 content::NotificationRegistrar registrar_; 120 content::NotificationRegistrar registrar_;
112 base::OneShotTimer<SSLErrorHandler> timer_; 121 base::OneShotTimer<SSLErrorHandler> timer_;
113 122
123 scoped_ptr<CommonNameMismatchHandler> common_name_mismatch_handler_;
124
114 scoped_ptr<SSLCertReporter> ssl_cert_reporter_; 125 scoped_ptr<SSLCertReporter> ssl_cert_reporter_;
115 126
116 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); 127 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler);
117 }; 128 };
118 129
119 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ 130 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698