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

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: Resolved comments, added UMA Created 5 years, 4 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/profiles/profile.h"
15 #include "chrome/browser/ssl/common_name_mismatch_handler.h"
14 #include "chrome/browser/ssl/ssl_cert_reporter.h" 16 #include "chrome/browser/ssl/ssl_cert_reporter.h"
15 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
18 #include "content/public/browser/web_contents_user_data.h" 20 #include "content/public/browser/web_contents_user_data.h"
19 #include "net/ssl/ssl_info.h" 21 #include "net/ssl/ssl_info.h"
20 #include "url/gurl.h" 22 #include "url/gurl.h"
21 23
22 namespace content { 24 namespace content {
23 class RenderViewHost; 25 class RenderViewHost;
(...skipping 30 matching lines...) Expand all
54 int options_mask, 56 int options_mask,
55 scoped_ptr<SSLCertReporter> ssl_cert_reporter, 57 scoped_ptr<SSLCertReporter> ssl_cert_reporter,
56 const base::Callback<void(bool)>& callback); 58 const base::Callback<void(bool)>& callback);
57 59
58 static void SetInterstitialDelayTypeForTest(InterstitialDelayType delay); 60 static void SetInterstitialDelayTypeForTest(InterstitialDelayType delay);
59 61
60 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback; 62 typedef base::Callback<void(content::WebContents*)> TimerStartedCallback;
61 static void SetInterstitialTimerStartedCallbackForTest( 63 static void SetInterstitialTimerStartedCallbackForTest(
62 TimerStartedCallback* callback); 64 TimerStartedCallback* callback);
63 65
66 // Gets the result of whether the suggested URL is valid. Displays
67 // common name mismatch interstitial or ssl interstitial accordingly.
68 void CommonNameMismatchHandlerCallback(
69 const CommonNameMismatchHandler::Results& results);
70
64 protected: 71 protected:
65 SSLErrorHandler(content::WebContents* web_contents, 72 SSLErrorHandler(content::WebContents* web_contents,
66 int cert_error, 73 int cert_error,
67 const net::SSLInfo& ssl_info, 74 const net::SSLInfo& ssl_info,
68 const GURL& request_url, 75 const GURL& request_url,
69 int options_mask, 76 int options_mask,
70 scoped_ptr<SSLCertReporter> ssl_cert_reporter, 77 scoped_ptr<SSLCertReporter> ssl_cert_reporter,
71 const base::Callback<void(bool)>& callback); 78 const base::Callback<void(bool)>& callback);
72 79
73 ~SSLErrorHandler() override; 80 ~SSLErrorHandler() override;
74 81
75 // Called when an SSL cert error is encountered. Triggers a captive portal 82 // 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" 83 // check and fires a one shot timer to wait for a "captive portal detected"
77 // result to arrive. 84 // result to arrive.
78 void StartHandlingError(); 85 void StartHandlingError();
79 const base::OneShotTimer<SSLErrorHandler>& get_timer() const { 86 const base::OneShotTimer<SSLErrorHandler>& get_timer() const {
80 return timer_; 87 return timer_;
81 } 88 }
82 89
83 private: 90 private:
84 // Callback for the one-shot timer. When the timer expires, an SSL error is 91 // Callback for the one-shot timer. When the timer expires, an SSL error is
85 // immediately displayed. 92 // immediately displayed.
86 void OnTimerExpired(); 93 void OnTimerExpired();
87 94
88 // These are virtual for tests: 95 // These are virtual for tests:
89 virtual void CheckForCaptivePortal(); 96 virtual void CheckForCaptivePortal();
90 virtual void ShowCaptivePortalInterstitial(const GURL& landing_url); 97 virtual void ShowCaptivePortalInterstitial(const GURL& landing_url);
91 virtual void ShowSSLInterstitial(); 98 virtual void ShowSSLInterstitial(const GURL& suggested_url);
99 virtual bool GetSuggestedUrl(const std::vector<std::string>& dns_names,
100 GURL* suggested_url) const;
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
104 content::WebContents* web_contents_; 114 content::WebContents* web_contents_;
105 const int cert_error_; 115 const int cert_error_;
106 const net::SSLInfo ssl_info_; 116 const net::SSLInfo ssl_info_;
107 const GURL request_url_; 117 const GURL request_url_;
108 const int options_mask_; 118 const int options_mask_;
109 base::Callback<void(bool)> callback_; 119 base::Callback<void(bool)> callback_;
110 120
meacer 2015/07/30 19:40:22 Remove blank line.
Bhanu Dev 2015/07/31 00:07:16 Done.
121 Profile* profile_;
meacer 2015/07/30 19:40:21 Can this be const? (either const Profile* or Profi
Bhanu Dev 2015/07/31 00:07:16 it can be Profile* const profile_
122
111 content::NotificationRegistrar registrar_; 123 content::NotificationRegistrar registrar_;
112 base::OneShotTimer<SSLErrorHandler> timer_; 124 base::OneShotTimer<SSLErrorHandler> timer_;
113 125
126 scoped_ptr<CommonNameMismatchHandler> common_name_mismatch_handler_;
127
114 scoped_ptr<SSLCertReporter> ssl_cert_reporter_; 128 scoped_ptr<SSLCertReporter> ssl_cert_reporter_;
115 129
116 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); 130 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler);
117 }; 131 };
118 132
119 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ 133 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698