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 static void Show(content::WebContents* web_contents, |
| 54 int cert_error, |
| 55 const net::SSLInfo& ssl_info, |
| 56 const GURL& request_url, |
| 57 bool overridable, |
| 58 bool strict_enforcement, |
| 59 const base::Callback<void(bool)>& callback); |
| 60 |
| 61 static SSLBlockingPage* CreateForWebUI(content::WebContents* web_contents, |
| 62 int cert_error, |
| 63 const net::SSLInfo& ssl_info, |
| 64 const GURL& request_url, |
| 65 bool overridable, |
| 66 bool strict_enforcement); |
| 67 |
61 // A method that sets strings in the specified dictionary from the passed | 68 // 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/ | 69 // vector so that they can be used to resource the ssl_roadblock.html/ |
63 // ssl_error.html files. | 70 // ssl_error.html files. |
64 // Note: there can be up to 5 strings in |extra_info|. | 71 // Note: there can be up to 5 strings in |extra_info|. |
65 static void SetExtraInfo(base::DictionaryValue* strings, | 72 static void SetExtraInfo(base::DictionaryValue* strings, |
66 const std::vector<base::string16>& extra_info); | 73 const std::vector<base::string16>& extra_info); |
67 | 74 |
68 protected: | 75 protected: |
69 // InterstitialPageDelegate implementation. | 76 // InterstitialPageDelegate implementation. |
70 virtual std::string GetHTMLContents() OVERRIDE; | 77 virtual std::string GetHTMLContents() OVERRIDE; |
71 virtual void CommandReceived(const std::string& command) OVERRIDE; | 78 virtual void CommandReceived(const std::string& command) OVERRIDE; |
72 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; | 79 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; |
73 virtual void OverrideRendererPrefs( | 80 virtual void OverrideRendererPrefs( |
74 content::RendererPreferences* prefs) OVERRIDE; | 81 content::RendererPreferences* prefs) OVERRIDE; |
75 virtual void OnProceed() OVERRIDE; | 82 virtual void OnProceed() OVERRIDE; |
76 virtual void OnDontProceed() OVERRIDE; | 83 virtual void OnDontProceed() OVERRIDE; |
77 | 84 |
78 private: | 85 private: |
| 86 SSLBlockingPage( |
| 87 content::WebContents* web_contents, |
| 88 bool create_interstitial, |
| 89 int cert_error, |
| 90 const net::SSLInfo& ssl_info, |
| 91 const GURL& request_url, |
| 92 bool overridable, |
| 93 bool strict_enforcement, |
| 94 const base::Callback<void(bool)>& callback); |
| 95 |
79 void NotifyDenyCertificate(); | 96 void NotifyDenyCertificate(); |
80 void NotifyAllowCertificate(); | 97 void NotifyAllowCertificate(); |
81 | 98 |
82 // These fetch the appropriate HTML page, depending on the | 99 // These fetch the appropriate HTML page, depending on the |
83 // SSLInterstitialVersion Finch trial. | 100 // SSLInterstitialVersion Finch trial. |
84 std::string GetHTMLContentsV1(); | 101 std::string GetHTMLContentsV1(); |
85 std::string GetHTMLContentsV2(); | 102 std::string GetHTMLContentsV2(); |
86 | 103 |
87 // Used to query the HistoryService to see if the URL is in history. For UMA. | 104 // 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); | 105 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 | 138 |
122 // For the FieldTrial: this contains the name of the condition. | 139 // For the FieldTrial: this contains the name of the condition. |
123 std::string trial_condition_; | 140 std::string trial_condition_; |
124 | 141 |
125 content::NotificationRegistrar registrar_; | 142 content::NotificationRegistrar registrar_; |
126 | 143 |
127 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 144 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
128 }; | 145 }; |
129 | 146 |
130 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 147 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |