Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.h

Issue 113391: Refactor the inner classes from SSLManager to their own files to reduce the c... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_BLOCKING_PAGE_H_ 5 #ifndef CHROME_BROWSER_SSL_BLOCKING_PAGE_H_
6 #define CHROME_BROWSER_SSL_BLOCKING_PAGE_H_ 6 #define CHROME_BROWSER_SSL_BLOCKING_PAGE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/ssl/ssl_manager.h" 10 #include "chrome/browser/ssl/ssl_error_info.h"
11 #include "chrome/browser/tab_contents/interstitial_page.h" 11 #include "chrome/browser/tab_contents/interstitial_page.h"
12 12
13 class DictionaryValue; 13 class DictionaryValue;
14 class SSLCertErrorHandler;
14 15
15 // This class is responsible for showing/hiding the interstitial page that is 16 // This class is responsible for showing/hiding the interstitial page that is
16 // shown when a certificate error happens. 17 // shown when a certificate error happens.
17 // It deletes itself when the interstitial page is closed. 18 // It deletes itself when the interstitial page is closed.
18 class SSLBlockingPage : public InterstitialPage { 19 class SSLBlockingPage : public InterstitialPage {
19 public: 20 public:
20 // An interface that classes that want to interact with the SSLBlockingPage 21 // An interface that classes that want to interact with the SSLBlockingPage
21 // should implement. 22 // should implement.
22 class Delegate { 23 class Delegate {
23 public: 24 public:
24 // Should return the information about the error that causes this blocking 25 // Should return the information about the error that causes this blocking
25 // page. 26 // page.
26 virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error) = 0; 27 virtual SSLErrorInfo GetSSLErrorInfo(SSLCertErrorHandler* handler) = 0;
27 28
28 // Notification that the user chose to reject the certificate. 29 // Notification that the user chose to reject the certificate.
29 virtual void OnDenyCertificate(SSLManager::CertError* error) = 0; 30 virtual void OnDenyCertificate(SSLCertErrorHandler* handler) = 0;
30 31
31 // Notification that the user chose to accept the certificate. 32 // Notification that the user chose to accept the certificate.
32 virtual void OnAllowCertificate(SSLManager::CertError* error) = 0; 33 virtual void OnAllowCertificate(SSLCertErrorHandler* handler) = 0;
33 }; 34 };
34 35
35 SSLBlockingPage(SSLManager::CertError* error, Delegate* delegate); 36 SSLBlockingPage(SSLCertErrorHandler* handler, Delegate* delegate);
36 virtual ~SSLBlockingPage(); 37 virtual ~SSLBlockingPage();
37 38
38 // 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
39 // 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/
40 // ssl_error.html files. 41 // ssl_error.html files.
41 // Note: there can be up to 5 strings in |extra_info|. 42 // Note: there can be up to 5 strings in |extra_info|.
42 static void SetExtraInfo(DictionaryValue* strings, 43 static void SetExtraInfo(DictionaryValue* strings,
43 const std::vector<std::wstring>& extra_info); 44 const std::vector<std::wstring>& extra_info);
44 45
45 protected: 46 protected:
46 // InterstitialPage implementation. 47 // InterstitialPage implementation.
47 virtual std::string GetHTMLContents(); 48 virtual std::string GetHTMLContents();
48 virtual void CommandReceived(const std::string& command); 49 virtual void CommandReceived(const std::string& command);
49 virtual void UpdateEntry(NavigationEntry* entry); 50 virtual void UpdateEntry(NavigationEntry* entry);
50 virtual void Proceed(); 51 virtual void Proceed();
51 virtual void DontProceed(); 52 virtual void DontProceed();
52 53
53 private: 54 private:
54 void NotifyDenyCertificate(); 55 void NotifyDenyCertificate();
55 void NotifyAllowCertificate(); 56 void NotifyAllowCertificate();
56 57
57 // The error we represent. We will either call CancelRequest() or 58 // The error we represent. We will either call CancelRequest() or
58 // ContinueRequest() on this object. 59 // ContinueRequest() on this object.
59 scoped_refptr<SSLManager::CertError> error_; 60 scoped_refptr<SSLCertErrorHandler> handler_;
60 61
61 // Our delegate. It provides useful information, like the title and details 62 // Our delegate. It provides useful information, like the title and details
62 // about this error. 63 // about this error.
63 Delegate* delegate_; 64 Delegate* delegate_;
64 65
65 // A flag to indicate if we've notified |delegate_| of the user's decision. 66 // A flag to indicate if we've notified |delegate_| of the user's decision.
66 bool delegate_has_been_notified_; 67 bool delegate_has_been_notified_;
67 68
68 69
69 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); 70 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage);
70 }; 71 };
71 72
72 #endif // #ifndef CHROME_BROWSER_SSL_BLOCKING_PAGE_H_ 73 #endif // #ifndef CHROME_BROWSER_SSL_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698