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

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

Issue 46094: Fix our handling of mixed SSL / non-SSL content.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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_POLICY_H__ 5 #ifndef CHROME_BROWSER_SSL_POLICY_H__
6 #define CHROME_BROWSER_SSL_POLICY_H__ 6 #define CHROME_BROWSER_SSL_POLICY_H__
7 7
8 #include "base/singleton.h"
8 #include "chrome/browser/ssl/ssl_blocking_page.h" 9 #include "chrome/browser/ssl/ssl_blocking_page.h"
9 #include "chrome/browser/ssl/ssl_manager.h" 10 #include "chrome/browser/ssl/ssl_manager.h"
10 11
11 // The basic SSLPolicy. This class contains default implementations of all 12 // The basic SSLPolicy. This class contains default implementations of all
12 // the SSLPolicy entry points. It is expected that subclasses will override 13 // the SSLPolicy entry points. It is expected that subclasses will override
13 // most of these methods to implement policy specific to certain errors or 14 // most of these methods to implement policy specific to certain errors or
14 // situations. 15 // situations.
15 class SSLPolicy : public SSLManager::Delegate, 16 class SSLPolicy : public SSLManager::Delegate,
16 public SSLBlockingPage::Delegate { 17 public SSLBlockingPage::Delegate {
17 public: 18 public:
18 // Factory method to get the default policy. 19 // Factory method to get the default policy.
19 //
20 // SSLPolicy is not meant to be instantiated itself. Only subclasses should
21 // be instantiated. The default policy has more complex behavior than a
22 // direct instance of SSLPolicy.
23 static SSLPolicy* GetDefaultPolicy(); 20 static SSLPolicy* GetDefaultPolicy();
24 21
25 // SSLManager::Delegate methods. 22 // SSLManager::Delegate methods.
26 virtual void OnCertError(const GURL& main_frame_url, 23 virtual void OnCertError(SSLManager::CertError* error);
27 SSLManager::CertError* error); 24 virtual void OnMixedContent(SSLManager::MixedContentHandler* handler);
28 virtual void OnMixedContent( 25 virtual void OnRequestStarted(SSLManager::RequestInfo* info);
29 NavigationController* navigation_controller, 26 virtual void UpdateEntry(SSLManager* manager, NavigationEntry* entry);
30 const GURL& main_frame_url,
31 SSLManager::MixedContentHandler* mixed_content_handler) {
32 // So far only the default policy is expected to receive mixed-content
33 // calls.
34 NOTREACHED();
35 }
36 27
37 virtual void OnRequestStarted(SSLManager* manager, 28 // This method is static because it is called from both the UI and the IO
38 const GURL& url, 29 // threads.
39 ResourceType::Type resource_type, 30 static bool IsMixedContent(const GURL& url,
40 int ssl_cert_id, 31 ResourceType::Type resource_type,
41 int ssl_cert_status); 32 const std::string& frame_origin);
42 virtual SecurityStyle GetDefaultStyle(const GURL& url);
43 33
44 // SSLBlockingPage::Delegate methods. 34 // SSLBlockingPage::Delegate methods.
45 virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error); 35 virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error);
46 virtual void OnDenyCertificate(SSLManager::CertError* error); 36 virtual void OnDenyCertificate(SSLManager::CertError* error);
47 virtual void OnAllowCertificate(SSLManager::CertError* error); 37 virtual void OnAllowCertificate(SSLManager::CertError* error);
48 38
39 void AllowMixedContent(SSLManager::MixedContentHandler* handler);
40
49 protected: 41 protected:
50 // Allow our subclasses to construct us. 42 // Construct via |GetDefaultPolicy|.
51 SSLPolicy(); 43 SSLPolicy();
44 friend struct DefaultSingletonTraits<SSLPolicy>;
52 45
53 // Helper method for derived classes handling certificate errors that can be 46 // Helper method for derived classes handling certificate errors that can be
54 // overridden by the user. 47 // overridden by the user.
55 // Show a blocking page and let the user continue or cancel the request. 48 // Show a blocking page and let the user continue or cancel the request.
56 void OnOverridableCertError(const GURL& main_frame_url, 49 void OnOverridableCertError(SSLManager::CertError* error);
57 SSLManager::CertError* error);
58 50
59 // Helper method for derived classes handling fatal certificate errors. 51 // Helper method for derived classes handling fatal certificate errors.
60 // Cancel the request and show an error page. 52 // Cancel the request and show an error page.
61 void OnFatalCertError(const GURL& main_frame_url, 53 void OnFatalCertError(SSLManager::CertError* error);
62 SSLManager::CertError* error); 54
55 // Helper method for dealing with origin strings.
56 void MarkOriginAsBroken(SSLManager* manager, const std::string& origin);
57 void UpdateStateForMixedContent(SSLManager::RequestInfo* info);
58 void UpdateStateForUnsafeContent(SSLManager::RequestInfo* info);
63 59
64 private: 60 private:
65 DISALLOW_EVIL_CONSTRUCTORS(SSLPolicy); 61 DISALLOW_COPY_AND_ASSIGN(SSLPolicy);
66 }; 62 };
67 63
68 #endif // CHROME_BROWSER_SSL_POLICY_H__ 64 #endif // CHROME_BROWSER_SSL_POLICY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698