| 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 ~SSLBlockingPage() override; | 59 ~SSLBlockingPage() override; |
| 52 | 60 |
| 53 // Creates an SSL blocking page. If the blocking page isn't shown, the caller | 61 // Creates an SSL blocking page. If the blocking page isn't shown, the caller |
| 54 // is responsible for cleaning up the blocking page, otherwise the | 62 // is responsible for cleaning up the blocking page, otherwise the |
| 55 // interstitial takes ownership when shown. |options_mask| must be a bitwise | 63 // interstitial takes ownership when shown. |options_mask| must be a bitwise |
| 56 // mask of SSLBlockingPageOptionsMask values. | 64 // mask of SSLBlockingPageOptionsMask values. |
| 57 SSLBlockingPage(content::WebContents* web_contents, | 65 SSLBlockingPage(content::WebContents* web_contents, |
| 58 int cert_error, | 66 int cert_error, |
| 59 const net::SSLInfo& ssl_info, | 67 const net::SSLInfo& ssl_info, |
| 60 const GURL& request_url, | 68 const GURL& request_url, |
| 61 int options_mask, | 69 int options_mask, |
| 62 const base::Callback<void(bool)>& callback); | 70 const base::Callback<void(bool)>& callback); |
| 63 | 71 |
| 64 // SecurityInterstitialPage method: | 72 // SecurityInterstitialPage method: |
| 65 virtual SecurityInterstitialPage::Type GetTypeForTesting() const override; | 73 virtual SecurityInterstitialPage::Type GetTypeForTesting() const override; |
| 66 | 74 |
| 67 // A method that sets strings in the specified dictionary from the passed | 75 // A method that sets strings in the specified dictionary from the passed |
| 68 // vector so that they can be used to resource the ssl_roadblock.html/ | 76 // vector so that they can be used to resource the ssl_roadblock.html/ |
| 69 // ssl_error.html files. | 77 // ssl_error.html files. |
| 70 // Note: there can be up to 5 strings in |extra_info|. | 78 // Note: there can be up to 5 strings in |extra_info|. |
| 71 static void SetExtraInfo(base::DictionaryValue* strings, | 79 static void SetExtraInfo(base::DictionaryValue* strings, |
| 72 const std::vector<base::string16>& extra_info); | 80 const std::vector<base::string16>& extra_info); |
| 73 | 81 |
| 82 static bool IsOverridable(const int options_mask) { |
| 83 return (options_mask & SSLBlockingPage::OVERRIDABLE) && |
| 84 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT); |
| 85 } |
| 86 |
| 74 protected: | 87 protected: |
| 75 // InterstitialPageDelegate implementation. | 88 // InterstitialPageDelegate implementation. |
| 76 virtual void CommandReceived(const std::string& command) override; | 89 virtual void CommandReceived(const std::string& command) override; |
| 77 virtual void OverrideEntry(content::NavigationEntry* entry) override; | 90 virtual void OverrideEntry(content::NavigationEntry* entry) override; |
| 78 virtual void OverrideRendererPrefs( | 91 virtual void OverrideRendererPrefs( |
| 79 content::RendererPreferences* prefs) override; | 92 content::RendererPreferences* prefs) override; |
| 80 virtual void OnProceed() override; | 93 virtual void OnProceed() override; |
| 81 virtual void OnDontProceed() override; | 94 virtual void OnDontProceed() override; |
| 82 | 95 |
| 83 // SecurityInterstitialPage implementation: | 96 // SecurityInterstitialPage implementation: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // For Chrome Experience Sampling Platform: this maintains event state. | 130 // For Chrome Experience Sampling Platform: this maintains event state. |
| 118 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 131 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 119 #endif | 132 #endif |
| 120 | 133 |
| 121 content::NotificationRegistrar registrar_; | 134 content::NotificationRegistrar registrar_; |
| 122 | 135 |
| 123 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 136 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 124 }; | 137 }; |
| 125 | 138 |
| 126 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 139 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |