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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // DO NOT reorder or change these without also changing the JavaScript! | 47 // DO NOT reorder or change these without also changing the JavaScript! |
48 enum SSLBlockingPageCommands { | 48 enum SSLBlockingPageCommands { |
49 CMD_DONT_PROCEED = 0, | 49 CMD_DONT_PROCEED = 0, |
50 CMD_PROCEED = 1, | 50 CMD_PROCEED = 1, |
51 CMD_MORE = 2, | 51 CMD_MORE = 2, |
52 CMD_RELOAD = 3, | 52 CMD_RELOAD = 3, |
53 CMD_HELP = 4, | 53 CMD_HELP = 4, |
54 CMD_CLOCK = 5 | 54 CMD_CLOCK = 5 |
55 }; | 55 }; |
56 | 56 |
| 57 enum SSLBlockingPageOptionsMask { |
| 58 OVERRIDABLE = 1 << 0, |
| 59 STRICT_ENFORCEMENT = 1 << 1, |
| 60 EXPIRED_BUT_PREVIOUSLY_ALLOWED = 1 << 2 |
| 61 }; |
| 62 |
57 virtual ~SSLBlockingPage(); | 63 virtual ~SSLBlockingPage(); |
58 | 64 |
59 // Create an interstitial and show it. | 65 // Create an interstitial and show it. |
60 void Show(); | 66 void Show(); |
61 | 67 |
62 // Creates an SSL blocking page. If the blocking page isn't shown, the caller | 68 // Creates an SSL blocking page. If the blocking page isn't shown, the caller |
63 // is responsible for cleaning up the blocking page, otherwise the | 69 // is responsible for cleaning up the blocking page, otherwise the |
64 // interstitial takes ownership when shown. | 70 // interstitial takes ownership when shown. |options_mask| must be a bitwise |
65 SSLBlockingPage( | 71 // mask of SSLBlockingPageOptionsMask values. |
66 content::WebContents* web_contents, | 72 SSLBlockingPage(content::WebContents* web_contents, |
67 int cert_error, | 73 int cert_error, |
68 const net::SSLInfo& ssl_info, | 74 const net::SSLInfo& ssl_info, |
69 const GURL& request_url, | 75 const GURL& request_url, |
70 bool overridable, | 76 int options_mask, |
71 bool strict_enforcement, | 77 const base::Callback<void(bool)>& callback); |
72 const base::Callback<void(bool)>& callback); | |
73 | 78 |
74 // A method that sets strings in the specified dictionary from the passed | 79 // A method that sets strings in the specified dictionary from the passed |
75 // vector so that they can be used to resource the ssl_roadblock.html/ | 80 // vector so that they can be used to resource the ssl_roadblock.html/ |
76 // ssl_error.html files. | 81 // ssl_error.html files. |
77 // Note: there can be up to 5 strings in |extra_info|. | 82 // Note: there can be up to 5 strings in |extra_info|. |
78 static void SetExtraInfo(base::DictionaryValue* strings, | 83 static void SetExtraInfo(base::DictionaryValue* strings, |
79 const std::vector<base::string16>& extra_info); | 84 const std::vector<base::string16>& extra_info); |
80 | 85 |
81 protected: | 86 protected: |
82 // InterstitialPageDelegate implementation. | 87 // InterstitialPageDelegate implementation. |
(...skipping 14 matching lines...) Expand all Loading... |
97 | 102 |
98 // content::NotificationObserver: | 103 // content::NotificationObserver: |
99 virtual void Observe( | 104 virtual void Observe( |
100 int type, | 105 int type, |
101 const content::NotificationSource& source, | 106 const content::NotificationSource& source, |
102 const content::NotificationDetails& details) OVERRIDE; | 107 const content::NotificationDetails& details) OVERRIDE; |
103 | 108 |
104 base::Callback<void(bool)> callback_; | 109 base::Callback<void(bool)> callback_; |
105 | 110 |
106 content::WebContents* web_contents_; | 111 content::WebContents* web_contents_; |
107 int cert_error_; | 112 const int cert_error_; |
108 const net::SSLInfo ssl_info_; | 113 const net::SSLInfo ssl_info_; |
109 GURL request_url_; | 114 const GURL request_url_; |
110 // Could the user successfully override the error? | 115 // Could the user successfully override the error? |
111 // overridable_ will be set to false if strict_enforcement_ is true. | 116 // overridable_ will be set to false if strict_enforcement_ is true. |
112 bool overridable_; | 117 const bool overridable_; |
113 // Has the site requested strict enforcement of certificate errors? | 118 // Has the site requested strict enforcement of certificate errors? |
114 bool strict_enforcement_; | 119 const bool strict_enforcement_; |
115 content::InterstitialPage* interstitial_page_; // Owns us. | 120 content::InterstitialPage* interstitial_page_; // Owns us. |
116 // Is the hostname for an internal network? | 121 // Is the hostname for an internal network? |
117 bool internal_; | 122 bool internal_; |
118 // How many times is this same URL in history? | 123 // How many times is this same URL in history? |
119 int num_visits_; | 124 int num_visits_; |
120 // Used for getting num_visits_. | 125 // Used for getting num_visits_. |
121 base::CancelableTaskTracker request_tracker_; | 126 base::CancelableTaskTracker request_tracker_; |
122 // Is captive portal detection enabled? | 127 // Is captive portal detection enabled? |
123 bool captive_portal_detection_enabled_; | 128 bool captive_portal_detection_enabled_; |
124 // Did the probe complete before the interstitial was closed? | 129 // Did the probe complete before the interstitial was closed? |
125 bool captive_portal_probe_completed_; | 130 bool captive_portal_probe_completed_; |
126 // Did the captive portal probe receive an error or get a non-HTTP response? | 131 // Did the captive portal probe receive an error or get a non-HTTP response? |
127 bool captive_portal_no_response_; | 132 bool captive_portal_no_response_; |
128 // Was a captive portal detected? | 133 // Was a captive portal detected? |
129 bool captive_portal_detected_; | 134 bool captive_portal_detected_; |
| 135 // Did the user previously allow a bad certificate but the decision has now |
| 136 // expired? |
| 137 const bool expired_but_previously_allowed_; |
130 | 138 |
131 // For the FieldTrial: this contains the name of the condition. | 139 // For the FieldTrial: this contains the name of the condition. |
132 std::string trial_condition_; | 140 std::string trial_condition_; |
133 | 141 |
134 #if defined(ENABLE_EXTENSIONS) | 142 #if defined(ENABLE_EXTENSIONS) |
135 // For Chrome Experience Sampling Platform: this maintains event state. | 143 // For Chrome Experience Sampling Platform: this maintains event state. |
136 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 144 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
137 #endif | 145 #endif |
138 | 146 |
139 content::NotificationRegistrar registrar_; | 147 content::NotificationRegistrar registrar_; |
140 | 148 |
141 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 149 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
142 }; | 150 }; |
143 | 151 |
144 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 152 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |