Chromium Code Reviews| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h" | 15 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h" |
| 16 #include "chrome/browser/interstitials/security_interstitial_page.h" | 16 #include "chrome/browser/interstitials/security_interstitial_page.h" |
| 17 #include "net/ssl/ssl_info.h" | 17 #include "net/ssl/ssl_info.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | |
|
Ryan Sleevi
2015/02/27 00:46:33
Forward declare
estark
2015/02/27 02:49:37
Just removed the #include all together because I m
| |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 #if defined(ENABLE_EXTENSIONS) | 21 #if defined(ENABLE_EXTENSIONS) |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 class ExperienceSamplingEvent; | 23 class ExperienceSamplingEvent; |
| 23 } | 24 } |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 class SSLErrorClassification; | 27 class SSLErrorClassification; |
| 27 | 28 |
| 28 // 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 |
| 29 // shown when a certificate error happens. | 30 // shown when a certificate error happens. |
| 30 // It deletes itself when the interstitial page is closed. | 31 // It deletes itself when the interstitial page is closed. |
| 31 class SSLBlockingPage : public SecurityInterstitialPage { | 32 class SSLBlockingPage : public SecurityInterstitialPage { |
| 32 public: | 33 public: |
| 33 // These represent the commands sent from the interstitial JavaScript. They | 34 // These represent the commands sent from the interstitial |
| 34 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. | 35 // JavaScript. They are defined in |
| 35 // DO NOT reorder or change these without also changing the JavaScript! | 36 // chrome/browser/resources/security_warnings/ssl_errors_common.js. |
| 37 // DO NOT reorder or change these without also changing the | |
| 38 // JavaScript! | |
| 36 enum SSLBlockingPageCommands { | 39 enum SSLBlockingPageCommands { |
| 37 CMD_DONT_PROCEED = 0, | 40 CMD_DONT_PROCEED = 0, |
| 38 CMD_PROCEED = 1, | 41 CMD_PROCEED = 1, |
| 39 CMD_MORE = 2, | 42 CMD_MORE = 2, |
| 40 CMD_RELOAD = 3, | 43 CMD_RELOAD = 3, |
| 41 CMD_HELP = 4, | 44 CMD_HELP = 4, |
| 42 CMD_CLOCK = 5 | 45 CMD_CLOCK = 5, |
| 46 CMD_DO_REPORT = 6, | |
| 47 CMD_DONT_REPORT = 7 | |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 enum SSLBlockingPageOptionsMask { | 50 enum SSLBlockingPageOptionsMask { |
| 46 // Indicates whether or not the user could (assuming perfect knowledge) | 51 // Indicates whether or not the user could (assuming perfect knowledge) |
| 47 // successfully override the error and still get the security guarantees | 52 // successfully override the error and still get the security guarantees |
| 48 // of TLS. | 53 // of TLS. |
| 49 OVERRIDABLE = 1 << 0, | 54 OVERRIDABLE = 1 << 0, |
| 50 // Indicates whether or not the site the user is trying to connect to has | 55 // Indicates whether or not the site the user is trying to connect to has |
| 51 // requested strict enforcement of certificate validation (e.g. with HTTP | 56 // requested strict enforcement of certificate validation (e.g. with HTTP |
| 52 // Strict-Transport-Security). | 57 // Strict-Transport-Security). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 void OverrideEntry(content::NavigationEntry* entry) override; | 89 void OverrideEntry(content::NavigationEntry* entry) override; |
| 85 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; | 90 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; |
| 86 void OnProceed() override; | 91 void OnProceed() override; |
| 87 void OnDontProceed() override; | 92 void OnDontProceed() override; |
| 88 | 93 |
| 89 // SecurityInterstitialPage implementation: | 94 // SecurityInterstitialPage implementation: |
| 90 bool ShouldCreateNewNavigation() const override; | 95 bool ShouldCreateNewNavigation() const override; |
| 91 void PopulateInterstitialStrings( | 96 void PopulateInterstitialStrings( |
| 92 base::DictionaryValue* load_time_data) override; | 97 base::DictionaryValue* load_time_data) override; |
| 93 | 98 |
| 99 // SecurityInterstitialPageWithExtendedReporting implementation: | |
| 100 void PopulateExtendedReportingOption( | |
| 101 base::DictionaryValue* load_time_data) override; | |
| 102 | |
| 94 private: | 103 private: |
| 95 void NotifyDenyCertificate(); | 104 void NotifyDenyCertificate(); |
| 96 void NotifyAllowCertificate(); | 105 void NotifyAllowCertificate(); |
| 97 | 106 |
| 98 std::string GetUmaHistogramPrefix() const; | 107 std::string GetUmaHistogramPrefix() const; |
| 99 std::string GetSamplingEventName() const; | 108 std::string GetSamplingEventName() const; |
| 100 | 109 |
| 110 // Send a report about an invalid certificate to the server (by | |
| 111 // posting a FinishCertCollectionInternal task to the IO thread). | |
| 112 void FinishCertCollection(); | |
| 113 | |
| 114 // The method that actually sends the cert collection report over the | |
| 115 // network. Must be called only on the IO thread. | |
| 116 static void FinishCertCollectionInternal( | |
| 117 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | |
|
Ryan Sleevi
2015/02/27 00:46:33
This should be "const scoped_refptr<net::URLReques
estark
2015/02/27 02:49:37
Done.
| |
| 118 const std::string& hostname, | |
| 119 const net::SSLInfo& ssl_info); | |
| 120 | |
| 101 base::Callback<void(bool)> callback_; | 121 base::Callback<void(bool)> callback_; |
| 102 | 122 |
| 103 const int cert_error_; | 123 const int cert_error_; |
| 104 const net::SSLInfo ssl_info_; | 124 const net::SSLInfo ssl_info_; |
| 105 // There are two ways for the user to override an interstitial: | 125 // There are two ways for the user to override an interstitial: |
| 106 // | 126 // |
| 107 // overridable_) By clicking on "Advanced" and then "Proceed". | 127 // overridable_) By clicking on "Advanced" and then "Proceed". |
| 108 // - This corresponds to "the user can override using the UI". | 128 // - This corresponds to "the user can override using the UI". |
| 109 // danger_overridable_) By typing the word "danger". | 129 // danger_overridable_) By typing the word "danger". |
| 110 // - This is an undocumented workaround. | 130 // - This is an undocumented workaround. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 122 // Which type of interstitial this is. | 142 // Which type of interstitial this is. |
| 123 enum SSLInterstitialReason { | 143 enum SSLInterstitialReason { |
| 124 SSL_REASON_SSL, | 144 SSL_REASON_SSL, |
| 125 SSL_REASON_BAD_CLOCK | 145 SSL_REASON_BAD_CLOCK |
| 126 } interstitial_reason_; | 146 } interstitial_reason_; |
| 127 | 147 |
| 128 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 148 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 129 }; | 149 }; |
| 130 | 150 |
| 131 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 151 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |