| 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); |
| 51 virtual ~SSLBlockingPage(); | 59 virtual ~SSLBlockingPage(); |
| 52 | 60 |
| 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 | |
| 74 // A method that sets strings in the specified dictionary from the passed | 61 // 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/ | 62 // vector so that they can be used to resource the ssl_roadblock.html/ |
| 76 // ssl_error.html files. | 63 // ssl_error.html files. |
| 77 // Note: there can be up to 5 strings in |extra_info|. | 64 // Note: there can be up to 5 strings in |extra_info|. |
| 78 static void SetExtraInfo(base::DictionaryValue* strings, | 65 static void SetExtraInfo(base::DictionaryValue* strings, |
| 79 const std::vector<base::string16>& extra_info); | 66 const std::vector<base::string16>& extra_info); |
| 80 | 67 |
| 81 protected: | 68 protected: |
| 82 // InterstitialPageDelegate implementation. | 69 // InterstitialPageDelegate implementation. |
| 83 virtual std::string GetHTMLContents() OVERRIDE; | 70 virtual std::string GetHTMLContents() OVERRIDE; |
| 84 virtual void CommandReceived(const std::string& command) OVERRIDE; | 71 virtual void CommandReceived(const std::string& command) OVERRIDE; |
| 85 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; | 72 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; |
| 86 virtual void OverrideRendererPrefs( | 73 virtual void OverrideRendererPrefs( |
| 87 content::RendererPreferences* prefs) OVERRIDE; | 74 content::RendererPreferences* prefs) OVERRIDE; |
| 88 virtual void OnProceed() OVERRIDE; | 75 virtual void OnProceed() OVERRIDE; |
| 89 virtual void OnDontProceed() OVERRIDE; | 76 virtual void OnDontProceed() OVERRIDE; |
| 90 | 77 |
| 91 private: | 78 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 | |
| 101 void NotifyDenyCertificate(); | 79 void NotifyDenyCertificate(); |
| 102 void NotifyAllowCertificate(); | 80 void NotifyAllowCertificate(); |
| 103 | 81 |
| 104 // These fetch the appropriate HTML page, depending on the | 82 // These fetch the appropriate HTML page, depending on the |
| 105 // SSLInterstitialVersion Finch trial. | 83 // SSLInterstitialVersion Finch trial. |
| 106 std::string GetHTMLContentsV1(); | 84 std::string GetHTMLContentsV1(); |
| 107 std::string GetHTMLContentsV2(); | 85 std::string GetHTMLContentsV2(); |
| 108 | 86 |
| 109 // Used to query the HistoryService to see if the URL is in history. For UMA. | 87 // Used to query the HistoryService to see if the URL is in history. For UMA. |
| 110 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 88 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 121 |
| 144 // For the FieldTrial: this contains the name of the condition. | 122 // For the FieldTrial: this contains the name of the condition. |
| 145 std::string trial_condition_; | 123 std::string trial_condition_; |
| 146 | 124 |
| 147 content::NotificationRegistrar registrar_; | 125 content::NotificationRegistrar registrar_; |
| 148 | 126 |
| 149 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 127 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
| 150 }; | 128 }; |
| 151 | 129 |
| 152 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 130 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
| OLD | NEW |