| 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 #ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class InterstitialPage; | 25 class InterstitialPage; |
| 26 class WebContents; | 26 class WebContents; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // This class is responsible for showing/hiding the interstitial page that is | 29 // This class is responsible for showing/hiding the interstitial page that is |
| 30 // shown when a certificate error happens. | 30 // shown when a certificate error happens. |
| 31 // It deletes itself when the interstitial page is closed. | 31 // It deletes itself when the interstitial page is closed. |
| 32 // | 32 class SSLBlockingPage : public content::InterstitialPageDelegate { |
| 33 // This class should only be used on the UI thread because its implementation | |
| 34 // uses captive_portal::CaptivePortalService which can only be accessed on the | |
| 35 // UI thread. | |
| 36 class SSLBlockingPage : public content::InterstitialPageDelegate, | |
| 37 public content::NotificationObserver { | |
| 38 public: | 33 public: |
| 39 // These represent the commands sent from the interstitial JavaScript. They | 34 // These represent the commands sent from the interstitial JavaScript. They |
| 40 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. | 35 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. |
| 41 // DO NOT reorder or change these without also changing the JavaScript! | 36 // DO NOT reorder or change these without also changing the JavaScript! |
| 42 enum SSLBlockingPageCommands { | 37 enum SSLBlockingPageCommands { |
| 43 CMD_DONT_PROCEED = 0, | 38 CMD_DONT_PROCEED = 0, |
| 44 CMD_PROCEED = 1, | 39 CMD_PROCEED = 1, |
| 45 CMD_MORE = 2, | 40 CMD_MORE = 2, |
| 46 CMD_RELOAD = 3, | 41 CMD_RELOAD = 3, |
| 47 CMD_HELP = 4, | 42 CMD_HELP = 4, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void OnProceed() OVERRIDE; | 77 virtual void OnProceed() OVERRIDE; |
| 83 virtual void OnDontProceed() OVERRIDE; | 78 virtual void OnDontProceed() OVERRIDE; |
| 84 | 79 |
| 85 private: | 80 private: |
| 86 void NotifyDenyCertificate(); | 81 void NotifyDenyCertificate(); |
| 87 void NotifyAllowCertificate(); | 82 void NotifyAllowCertificate(); |
| 88 | 83 |
| 89 // Used to query the HistoryService to see if the URL is in history. For UMA. | 84 // Used to query the HistoryService to see if the URL is in history. For UMA. |
| 90 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 85 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
| 91 | 86 |
| 92 // content::NotificationObserver: | |
| 93 virtual void Observe( | |
| 94 int type, | |
| 95 const content::NotificationSource& source, | |
| 96 const content::NotificationDetails& details) OVERRIDE; | |
| 97 | |
| 98 base::Callback<void(bool)> callback_; | 87 base::Callback<void(bool)> callback_; |
| 99 | 88 |
| 100 content::WebContents* web_contents_; | 89 content::WebContents* web_contents_; |
| 101 int cert_error_; | 90 int cert_error_; |
| 102 const net::SSLInfo ssl_info_; | 91 const net::SSLInfo ssl_info_; |
| 103 GURL request_url_; | 92 GURL request_url_; |
| 104 // Could the user successfully override the error? | 93 // Could the user successfully override the error? |
| 105 bool overridable_; | 94 bool overridable_; |
| 106 // Has the site requested strict enforcement of certificate errors? | 95 // Has the site requested strict enforcement of certificate errors? |
| 107 bool strict_enforcement_; | 96 bool strict_enforcement_; |
| 108 content::InterstitialPage* interstitial_page_; // Owns us. | 97 content::InterstitialPage* interstitial_page_; // Owns us. |
| 109 // Is the hostname for an internal network? | 98 // Is the hostname for an internal network? |
| 110 bool internal_; | 99 bool internal_; |
| 111 // How many times is this same URL in history? | 100 // How many times is this same URL in history? |
| 112 int num_visits_; | 101 int num_visits_; |
| 113 // Used for getting num_visits_. | 102 // Used for getting num_visits_. |
| 114 base::CancelableTaskTracker request_tracker_; | 103 base::CancelableTaskTracker request_tracker_; |
| 115 // Is captive portal detection enabled? | |
| 116 bool captive_portal_detection_enabled_; | |
| 117 // Did the probe complete before the interstitial was closed? | |
| 118 bool captive_portal_probe_completed_; | |
| 119 // Did the captive portal probe receive an error or get a non-HTTP response? | |
| 120 bool captive_portal_no_response_; | |
| 121 // Was a captive portal detected? | |
| 122 bool captive_portal_detected_; | |
| 123 | 104 |
| 124 content::NotificationRegistrar registrar_; | 105 content::NotificationRegistrar registrar_; |
| 125 | 106 |
| 126 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 107 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 127 }; | 108 }; |
| 128 | 109 |
| 129 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 110 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |