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_old.h" | 12 #include "base/callback_old.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 14 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
15 | 15 |
| 16 class SSLCertErrorHandler; |
| 17 |
| 18 namespace base { |
16 class DictionaryValue; | 19 class DictionaryValue; |
17 class SSLCertErrorHandler; | 20 } |
18 | 21 |
19 // This class is responsible for showing/hiding the interstitial page that is | 22 // This class is responsible for showing/hiding the interstitial page that is |
20 // shown when a certificate error happens. | 23 // shown when a certificate error happens. |
21 // It deletes itself when the interstitial page is closed. | 24 // It deletes itself when the interstitial page is closed. |
22 class SSLBlockingPage : public ChromeInterstitialPage { | 25 class SSLBlockingPage : public ChromeInterstitialPage { |
23 public: | 26 public: |
24 SSLBlockingPage(SSLCertErrorHandler* handler, | 27 SSLBlockingPage(SSLCertErrorHandler* handler, |
25 bool overridable, | 28 bool overridable, |
26 Callback2<SSLCertErrorHandler*, bool>::Type* callback); | 29 Callback2<SSLCertErrorHandler*, bool>::Type* callback); |
27 virtual ~SSLBlockingPage(); | 30 virtual ~SSLBlockingPage(); |
28 | 31 |
29 // A method that sets strings in the specified dictionary from the passed | 32 // A method that sets strings in the specified dictionary from the passed |
30 // vector so that they can be used to resource the ssl_roadblock.html/ | 33 // vector so that they can be used to resource the ssl_roadblock.html/ |
31 // ssl_error.html files. | 34 // ssl_error.html files. |
32 // Note: there can be up to 5 strings in |extra_info|. | 35 // Note: there can be up to 5 strings in |extra_info|. |
33 static void SetExtraInfo(DictionaryValue* strings, | 36 static void SetExtraInfo(base::DictionaryValue* strings, |
34 const std::vector<string16>& extra_info); | 37 const std::vector<string16>& extra_info); |
35 | 38 |
36 protected: | 39 protected: |
37 // ChromeInterstitialPage implementation. | 40 // ChromeInterstitialPage implementation. |
38 virtual std::string GetHTMLContents(); | 41 virtual std::string GetHTMLContents(); |
39 virtual void CommandReceived(const std::string& command); | 42 virtual void CommandReceived(const std::string& command); |
40 virtual void UpdateEntry(NavigationEntry* entry); | 43 virtual void UpdateEntry(NavigationEntry* entry); |
41 virtual void Proceed(); | 44 virtual void Proceed(); |
42 virtual void DontProceed(); | 45 virtual void DontProceed(); |
43 | 46 |
44 private: | 47 private: |
45 void NotifyDenyCertificate(); | 48 void NotifyDenyCertificate(); |
46 void NotifyAllowCertificate(); | 49 void NotifyAllowCertificate(); |
47 | 50 |
48 // The error we represent. We will either call CancelRequest() or | 51 // The error we represent. We will either call CancelRequest() or |
49 // ContinueRequest() on this object. | 52 // ContinueRequest() on this object. |
50 scoped_refptr<SSLCertErrorHandler> handler_; | 53 scoped_refptr<SSLCertErrorHandler> handler_; |
51 | 54 |
52 Callback2<SSLCertErrorHandler*, bool>::Type* callback_; | 55 Callback2<SSLCertErrorHandler*, bool>::Type* callback_; |
53 | 56 |
54 // Is the certificate error overridable or fatal? | 57 // Is the certificate error overridable or fatal? |
55 bool overridable_; | 58 bool overridable_; |
56 | 59 |
57 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 60 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
58 }; | 61 }; |
59 | 62 |
60 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 63 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |