OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 14 #include "content/public/browser/interstitial_page_delegate.h" |
15 | 15 |
| 16 class GURL; |
| 17 class InterstitialPage; |
16 class SSLCertErrorHandler; | 18 class SSLCertErrorHandler; |
17 | 19 |
18 namespace base { | 20 namespace base { |
19 class DictionaryValue; | 21 class DictionaryValue; |
20 } | 22 } |
21 | 23 |
| 24 namespace content { |
| 25 class WebContents; |
| 26 } |
| 27 |
22 // This class is responsible for showing/hiding the interstitial page that is | 28 // This class is responsible for showing/hiding the interstitial page that is |
23 // shown when a certificate error happens. | 29 // shown when a certificate error happens. |
24 // It deletes itself when the interstitial page is closed. | 30 // It deletes itself when the interstitial page is closed. |
25 class SSLBlockingPage : public ChromeInterstitialPage { | 31 class SSLBlockingPage : public content::InterstitialPageDelegate { |
26 public: | 32 public: |
27 SSLBlockingPage( | 33 SSLBlockingPage( |
28 SSLCertErrorHandler* handler, | 34 SSLCertErrorHandler* handler, |
29 bool overridable, | 35 bool overridable, |
30 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback); | 36 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback); |
31 virtual ~SSLBlockingPage(); | 37 virtual ~SSLBlockingPage(); |
32 | 38 |
33 // A method that sets strings in the specified dictionary from the passed | 39 // A method that sets strings in the specified dictionary from the passed |
34 // vector so that they can be used to resource the ssl_roadblock.html/ | 40 // vector so that they can be used to resource the ssl_roadblock.html/ |
35 // ssl_error.html files. | 41 // ssl_error.html files. |
36 // Note: there can be up to 5 strings in |extra_info|. | 42 // Note: there can be up to 5 strings in |extra_info|. |
37 static void SetExtraInfo(base::DictionaryValue* strings, | 43 static void SetExtraInfo(base::DictionaryValue* strings, |
38 const std::vector<string16>& extra_info); | 44 const std::vector<string16>& extra_info); |
39 | 45 |
40 protected: | 46 protected: |
41 // ChromeInterstitialPage implementation. | 47 // InterstitialPageDelegate implementation. |
42 virtual std::string GetHTMLContents() OVERRIDE; | 48 virtual std::string GetHTMLContents() OVERRIDE; |
43 virtual void CommandReceived(const std::string& command) OVERRIDE; | 49 virtual void CommandReceived(const std::string& command) OVERRIDE; |
44 virtual void UpdateEntry(content::NavigationEntry* entry) OVERRIDE; | 50 virtual void OverrideEntry(content::NavigationEntry* entry) OVERRIDE; |
45 virtual void Proceed() OVERRIDE; | 51 virtual void OverrideRendererPrefs( |
46 virtual void DontProceed() OVERRIDE; | 52 content::RendererPreferences* prefs) OVERRIDE; |
| 53 virtual void OnProceed() OVERRIDE; |
| 54 virtual void OnDontProceed() OVERRIDE; |
47 | 55 |
48 private: | 56 private: |
49 void NotifyDenyCertificate(); | 57 void NotifyDenyCertificate(); |
50 void NotifyAllowCertificate(); | 58 void NotifyAllowCertificate(); |
51 | 59 |
52 // The error we represent. We will either call CancelRequest() or | 60 // The error we represent. We will either call CancelRequest() or |
53 // ContinueRequest() on this object. | 61 // ContinueRequest() on this object. |
54 scoped_refptr<SSLCertErrorHandler> handler_; | 62 scoped_refptr<SSLCertErrorHandler> handler_; |
55 | 63 |
56 base::Callback<void(SSLCertErrorHandler*, bool)> callback_; | 64 base::Callback<void(SSLCertErrorHandler*, bool)> callback_; |
57 | 65 |
58 // Is the certificate error overridable or fatal? | 66 // Is the certificate error overridable or fatal? |
59 bool overridable_; | 67 bool overridable_; |
60 | 68 |
| 69 content::WebContents* web_contents_; |
| 70 InterstitialPage* interstitial_page_; // Owns us. |
| 71 |
61 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 72 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
62 }; | 73 }; |
63 | 74 |
64 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 75 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |