| 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 30 matching lines...) Expand all Loading... |
| 41 // DO NOT reorder or change these without also changing the JavaScript! | 41 // DO NOT reorder or change these without also changing the JavaScript! |
| 42 enum SSLBlockingPageCommands { | 42 enum SSLBlockingPageCommands { |
| 43 CMD_DONT_PROCEED = 0, | 43 CMD_DONT_PROCEED = 0, |
| 44 CMD_PROCEED = 1, | 44 CMD_PROCEED = 1, |
| 45 CMD_MORE = 2, | 45 CMD_MORE = 2, |
| 46 CMD_RELOAD = 3, | 46 CMD_RELOAD = 3, |
| 47 CMD_HELP = 4, | 47 CMD_HELP = 4, |
| 48 CMD_CLOCK = 5 | 48 CMD_CLOCK = 5 |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 SSLBlockingPage( | |
| 52 content::WebContents* web_contents, | |
| 53 int cert_error, | |
| 54 const net::SSLInfo& ssl_info, | |
| 55 const GURL& request_url, | |
| 56 bool overridable, | |
| 57 bool strict_enforcement, | |
| 58 const base::Callback<void(bool)>& callback); | |
| 59 virtual ~SSLBlockingPage(); | 51 virtual ~SSLBlockingPage(); |
| 60 | 52 |
| 53 // Creates an SSL blocking page and an interstitial for it, and shows the |
| 54 // interstitial. The interstitial owns the blocking page and is owned by |
| 55 // |web_contents|. |
| 56 static void Show(content::WebContents* web_contents, |
| 57 int cert_error, |
| 58 const net::SSLInfo& ssl_info, |
| 59 const GURL& request_url, |
| 60 bool overridable, |
| 61 bool strict_enforcement, |
| 62 const base::Callback<void(bool)>& callback); |
| 63 |
| 64 // Creates an SSL blocking page and an interstitial for it without |
| 65 // showing the interstitial. Since the interstitial isn't shown, the caller is |
| 66 // responsible for cleaning up the blocking page. |
| 67 static SSLBlockingPage* CreateForWebUI(content::WebContents* web_contents, |
| 68 int cert_error, |
| 69 const net::SSLInfo& ssl_info, |
| 70 const GURL& request_url, |
| 71 bool overridable, |
| 72 bool strict_enforcement); |
| 73 |
| 61 // A method that sets strings in the specified dictionary from the passed | 74 // A method that sets strings in the specified dictionary from the passed |
| 62 // vector so that they can be used to resource the ssl_roadblock.html/ | 75 // vector so that they can be used to resource the ssl_roadblock.html/ |
| 63 // ssl_error.html files. | 76 // ssl_error.html files. |
| 64 // Note: there can be up to 5 strings in |extra_info|. | 77 // Note: there can be up to 5 strings in |extra_info|. |
| 65 static void SetExtraInfo(base::DictionaryValue* strings, | 78 static void SetExtraInfo(base::DictionaryValue* strings, |
| 66 const std::vector<base::string16>& extra_info); | 79 const std::vector<base::string16>& extra_info); |
| 67 | 80 |
| 68 protected: | 81 protected: |
| 69 // InterstitialPageDelegate implementation. | 82 // InterstitialPageDelegate implementation. |
| 70 virtual std::string GetHTMLContents() OVERRIDE; | 83 virtual std::string GetHTMLContents() OVERRIDE; |
| 71 virtual void CommandReceived(const std::string& command) OVERRIDE; | 84 virtual void CommandReceived(const std::string& command) OVERRIDE; |
| 72 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; | 85 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; |
| 73 virtual void OverrideRendererPrefs( | 86 virtual void OverrideRendererPrefs( |
| 74 content::RendererPreferences* prefs) OVERRIDE; | 87 content::RendererPreferences* prefs) OVERRIDE; |
| 75 virtual void OnProceed() OVERRIDE; | 88 virtual void OnProceed() OVERRIDE; |
| 76 virtual void OnDontProceed() OVERRIDE; | 89 virtual void OnDontProceed() OVERRIDE; |
| 77 | 90 |
| 78 private: | 91 private: |
| 92 SSLBlockingPage( |
| 93 content::WebContents* web_contents, |
| 94 int cert_error, |
| 95 const net::SSLInfo& ssl_info, |
| 96 const GURL& request_url, |
| 97 bool overridable, |
| 98 bool strict_enforcement, |
| 99 const base::Callback<void(bool)>& callback); |
| 100 |
| 79 void NotifyDenyCertificate(); | 101 void NotifyDenyCertificate(); |
| 80 void NotifyAllowCertificate(); | 102 void NotifyAllowCertificate(); |
| 81 | 103 |
| 82 // These fetch the appropriate HTML page, depending on the | 104 // These fetch the appropriate HTML page, depending on the |
| 83 // SSLInterstitialVersion Finch trial. | 105 // SSLInterstitialVersion Finch trial. |
| 84 std::string GetHTMLContentsV1(); | 106 std::string GetHTMLContentsV1(); |
| 85 std::string GetHTMLContentsV2(); | 107 std::string GetHTMLContentsV2(); |
| 86 | 108 |
| 87 // Used to query the HistoryService to see if the URL is in history. For UMA. | 109 // Used to query the HistoryService to see if the URL is in history. For UMA. |
| 88 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 110 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 143 |
| 122 // For the FieldTrial: this contains the name of the condition. | 144 // For the FieldTrial: this contains the name of the condition. |
| 123 std::string trial_condition_; | 145 std::string trial_condition_; |
| 124 | 146 |
| 125 content::NotificationRegistrar registrar_; | 147 content::NotificationRegistrar registrar_; |
| 126 | 148 |
| 127 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 149 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 128 }; | 150 }; |
| 129 | 151 |
| 130 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 152 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |