| 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 25 matching lines...) Expand all Loading... |
| 36 enum SSLBlockingPageCommands { | 36 enum SSLBlockingPageCommands { |
| 37 CMD_DONT_PROCEED = 0, | 37 CMD_DONT_PROCEED = 0, |
| 38 CMD_PROCEED = 1, | 38 CMD_PROCEED = 1, |
| 39 CMD_MORE = 2, | 39 CMD_MORE = 2, |
| 40 CMD_RELOAD = 3, | 40 CMD_RELOAD = 3, |
| 41 CMD_HELP = 4, | 41 CMD_HELP = 4, |
| 42 CMD_CLOCK = 5 | 42 CMD_CLOCK = 5 |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 enum SSLBlockingPageOptionsMask { | 45 enum SSLBlockingPageOptionsMask { |
| 46 // Indicates whether or not the user could (assuming perfect knowledge) |
| 47 // successfully override the error and still get the security guarantees |
| 48 // of TLS. |
| 46 OVERRIDABLE = 1 << 0, | 49 OVERRIDABLE = 1 << 0, |
| 50 // 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 |
| 52 // Strict-Transport-Security). |
| 47 STRICT_ENFORCEMENT = 1 << 1, | 53 STRICT_ENFORCEMENT = 1 << 1, |
| 54 // Indicates whether a user decision had been previously made but the |
| 55 // decision has expired. |
| 48 EXPIRED_BUT_PREVIOUSLY_ALLOWED = 1 << 2 | 56 EXPIRED_BUT_PREVIOUSLY_ALLOWED = 1 << 2 |
| 49 }; | 57 }; |
| 50 | 58 |
| 51 // Interstitial type, used in tests. | 59 // Interstitial type, used in tests. |
| 52 static const void* kTypeForTesting; | 60 static const void* kTypeForTesting; |
| 53 | 61 |
| 54 ~SSLBlockingPage() override; | 62 ~SSLBlockingPage() override; |
| 55 | 63 |
| 56 // Creates an SSL blocking page. If the blocking page isn't shown, the caller | 64 // Creates an SSL blocking page. If the blocking page isn't shown, the caller |
| 57 // is responsible for cleaning up the blocking page, otherwise the | 65 // is responsible for cleaning up the blocking page, otherwise the |
| 58 // interstitial takes ownership when shown. |options_mask| must be a bitwise | 66 // interstitial takes ownership when shown. |options_mask| must be a bitwise |
| 59 // mask of SSLBlockingPageOptionsMask values. | 67 // mask of SSLBlockingPageOptionsMask values. |
| 60 SSLBlockingPage(content::WebContents* web_contents, | 68 SSLBlockingPage(content::WebContents* web_contents, |
| 61 int cert_error, | 69 int cert_error, |
| 62 const net::SSLInfo& ssl_info, | 70 const net::SSLInfo& ssl_info, |
| 63 const GURL& request_url, | 71 const GURL& request_url, |
| 64 int options_mask, | 72 int options_mask, |
| 65 const base::Callback<void(bool)>& callback); | 73 const base::Callback<void(bool)>& callback); |
| 66 | 74 |
| 67 // SecurityInterstitialPage method: | 75 // SecurityInterstitialPage method: |
| 68 const void* GetTypeForTesting() const override; | 76 const void* GetTypeForTesting() const override; |
| 69 | 77 |
| 70 // A method that sets strings in the specified dictionary from the passed | 78 // A method that sets strings in the specified dictionary from the passed |
| 71 // vector so that they can be used to resource the ssl_roadblock.html/ | 79 // vector so that they can be used to resource the ssl_roadblock.html/ |
| 72 // ssl_error.html files. | 80 // ssl_error.html files. |
| 73 // Note: there can be up to 5 strings in |extra_info|. | 81 // Note: there can be up to 5 strings in |extra_info|. |
| 74 static void SetExtraInfo(base::DictionaryValue* strings, | 82 static void SetExtraInfo(base::DictionaryValue* strings, |
| 75 const std::vector<base::string16>& extra_info); | 83 const std::vector<base::string16>& extra_info); |
| 76 | 84 |
| 85 static bool IsOverridable(int options_mask); |
| 86 |
| 77 protected: | 87 protected: |
| 78 // InterstitialPageDelegate implementation. | 88 // InterstitialPageDelegate implementation. |
| 79 void CommandReceived(const std::string& command) override; | 89 void CommandReceived(const std::string& command) override; |
| 80 void OverrideEntry(content::NavigationEntry* entry) override; | 90 void OverrideEntry(content::NavigationEntry* entry) override; |
| 81 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; | 91 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; |
| 82 void OnProceed() override; | 92 void OnProceed() override; |
| 83 void OnDontProceed() override; | 93 void OnDontProceed() override; |
| 84 | 94 |
| 85 // SecurityInterstitialPage implementation: | 95 // SecurityInterstitialPage implementation: |
| 86 bool ShouldCreateNewNavigation() const override; | 96 bool ShouldCreateNewNavigation() const override; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // For Chrome Experience Sampling Platform: this maintains event state. | 135 // For Chrome Experience Sampling Platform: this maintains event state. |
| 126 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 136 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 127 #endif | 137 #endif |
| 128 | 138 |
| 129 content::NotificationRegistrar registrar_; | 139 content::NotificationRegistrar registrar_; |
| 130 | 140 |
| 131 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 141 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 132 }; | 142 }; |
| 133 | 143 |
| 134 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 144 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |