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

Side by Side Diff: content/browser/ssl/ssl_manager.h

Issue 23947003: Create WebContentsObserver callbacks for notifications, remove notifications from SSLManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 7 years, 3 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) 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 CONTENT_BROWSER_SSL_SSL_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_SSL_SSL_MANAGER_H_
6 #define CONTENT_BROWSER_SSL_SSL_MANAGER_H_ 6 #define CONTENT_BROWSER_SSL_SSL_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "content/browser/ssl/ssl_error_handler.h" 13 #include "content/browser/ssl/ssl_error_handler.h"
14 #include "content/browser/ssl/ssl_policy_backend.h" 14 #include "content/browser/ssl/ssl_policy_backend.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/global_request_id.h" 16 #include "content/public/browser/global_request_id.h"
17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h"
19 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
20 #include "net/cert/cert_status_flags.h" 18 #include "net/cert/cert_status_flags.h"
21 #include "url/gurl.h" 19 #include "url/gurl.h"
22 20
23 namespace net { 21 namespace net {
24 class SSLInfo; 22 class SSLInfo;
25 } 23 }
26 24
27 namespace content { 25 namespace content {
28 class BrowserContext; 26 class BrowserContext;
29 class NavigationEntryImpl; 27 class NavigationEntryImpl;
30 class NavigationControllerImpl; 28 class NavigationControllerImpl;
31 class SSLPolicy; 29 class SSLPolicy;
30 struct LoadCommittedDetails;
32 struct LoadFromMemoryCacheDetails; 31 struct LoadFromMemoryCacheDetails;
33 struct ResourceRedirectDetails; 32 struct ResourceRedirectDetails;
34 struct ResourceRequestDetails; 33 struct ResourceRequestDetails;
35 34
36 // The SSLManager SSLManager controls the SSL UI elements in a WebContents. It 35 // The SSLManager SSLManager controls the SSL UI elements in a WebContents. It
37 // listens for various events that influence when these elements should or 36 // listens for various events that influence when these elements should or
38 // should not be displayed and adjusts them accordingly. 37 // should not be displayed and adjusts them accordingly.
39 // 38 //
40 // There is one SSLManager per tab. 39 // There is one SSLManager per tab.
41 // The security state (secure/insecure) is stored in the navigation entry. 40 // The security state (secure/insecure) is stored in the navigation entry.
42 // Along with it are stored any SSL error code and the associated cert. 41 // Along with it are stored any SSL error code and the associated cert.
43 42
44 class SSLManager : public NotificationObserver { 43 class SSLManager {
45 public: 44 public:
46 // Entry point for SSLCertificateErrors. This function begins the process 45 // Entry point for SSLCertificateErrors. This function begins the process
47 // of resolving a certificate error during an SSL connection. SSLManager 46 // of resolving a certificate error during an SSL connection. SSLManager
48 // will adjust the security UI and either call |CancelSSLRequest| or 47 // will adjust the security UI and either call |CancelSSLRequest| or
49 // |ContinueSSLRequest| of |delegate| with |id| as the first argument. 48 // |ContinueSSLRequest| of |delegate| with |id| as the first argument.
50 // 49 //
51 // Called on the IO thread. 50 // Called on the IO thread.
52 static void OnSSLCertificateError( 51 static void OnSSLCertificateError(
53 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, 52 const base::WeakPtr<SSLErrorHandler::Delegate>& delegate,
54 const GlobalRequestID& id, 53 const GlobalRequestID& id,
(...skipping 12 matching lines...) Expand all
67 explicit SSLManager(NavigationControllerImpl* controller); 66 explicit SSLManager(NavigationControllerImpl* controller);
68 virtual ~SSLManager(); 67 virtual ~SSLManager();
69 68
70 SSLPolicy* policy() { return policy_.get(); } 69 SSLPolicy* policy() { return policy_.get(); }
71 SSLPolicyBackend* backend() { return &backend_; } 70 SSLPolicyBackend* backend() { return &backend_; }
72 71
73 // The navigation controller associated with this SSLManager. The 72 // The navigation controller associated with this SSLManager. The
74 // NavigationController is guaranteed to outlive the SSLManager. 73 // NavigationController is guaranteed to outlive the SSLManager.
75 NavigationControllerImpl* controller() { return controller_; } 74 NavigationControllerImpl* controller() { return controller_; }
76 75
77 // This entry point is called directly (instead of via the notification 76 void DidCommitProvisionalLoad(const LoadCommittedDetails& details);
78 // service) because we need more precise control of the order in which folks 77 void DidLoadFromMemoryCache(const LoadFromMemoryCacheDetails& details);
79 // are notified of this event. 78 void DidStartResourceResponse(const ResourceRequestDetails& details);
80 void DidCommitProvisionalLoad(const NotificationDetails& details); 79 void DidReceiveResourceRedirect(const ResourceRedirectDetails& details);
81 80
82 // Insecure content entry point. 81 // Insecure content entry point.
83 void DidDisplayInsecureContent(); 82 void DidDisplayInsecureContent();
84 void DidRunInsecureContent(const std::string& security_origin); 83 void DidRunInsecureContent(const std::string& security_origin);
85 84
86 // Entry point for navigation. This function begins the process of updating
87 // the security UI when the main frame navigates to a new URL.
88 //
89 // Called on the UI thread.
90 virtual void Observe(int type,
91 const NotificationSource& source,
92 const NotificationDetails& details) OVERRIDE;
93
94 private: 85 private:
95 // Entry points for notifications to which we subscribe. Note that
96 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since
97 // the type we need is in NavigationController which would create a circular
98 // header file dependency.
99 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details);
100 void DidStartResourceResponse(ResourceRequestDetails* details);
101 void DidReceiveResourceRedirect(ResourceRedirectDetails* details);
102
103 // Update the NavigationEntry with our current state. 86 // Update the NavigationEntry with our current state.
104 void UpdateEntry(NavigationEntryImpl* entry); 87 void UpdateEntry(NavigationEntryImpl* entry);
105 88
106 // The backend for the SSLPolicy to actuate its decisions. 89 // The backend for the SSLPolicy to actuate its decisions.
107 SSLPolicyBackend backend_; 90 SSLPolicyBackend backend_;
108 91
109 // The SSLPolicy instance for this manager. 92 // The SSLPolicy instance for this manager.
110 scoped_ptr<SSLPolicy> policy_; 93 scoped_ptr<SSLPolicy> policy_;
111 94
112 // The NavigationController that owns this SSLManager. We are responsible 95 // The NavigationController that owns this SSLManager. We are responsible
113 // for the security UI of this tab. 96 // for the security UI of this tab.
114 NavigationControllerImpl* controller_; 97 NavigationControllerImpl* controller_;
115 98
116 // Handles registering notifications with the NotificationService.
117 NotificationRegistrar registrar_;
118
119 DISALLOW_COPY_AND_ASSIGN(SSLManager); 99 DISALLOW_COPY_AND_ASSIGN(SSLManager);
120 }; 100 };
121 101
122 } // namespace content 102 } // namespace content
123 103
124 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ 104 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_delegate.h ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698