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

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

Issue 12220100: Revert "content: convert SSL notifications to observer usage" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_policy_backend.h" 13 #include "content/browser/ssl/ssl_policy_backend.h"
14 #include "content/browser/ssl/ssl_error_handler.h" 14 #include "content/browser/ssl/ssl_error_handler.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" 17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "net/base/cert_status_flags.h" 20 #include "net/base/cert_status_flags.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 22
23 namespace net { 23 namespace net {
24 class SSLInfo; 24 class SSLInfo;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28 class BrowserContext;
29 class NavigationEntryImpl; 28 class NavigationEntryImpl;
30 class NavigationControllerImpl; 29 class NavigationControllerImpl;
31 class SSLPolicy; 30 class SSLPolicy;
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.
(...skipping 13 matching lines...) Expand all
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,
55 ResourceType::Type resource_type, 54 ResourceType::Type resource_type,
56 const GURL& url, 55 const GURL& url,
57 int render_process_id, 56 int render_process_id,
58 int render_view_id, 57 int render_view_id,
59 const net::SSLInfo& ssl_info, 58 const net::SSLInfo& ssl_info,
60 bool fatal); 59 bool fatal);
61 60
62 // Called when SSL state for a host or tab changes. 61 // Called when SSL state for a host or tab changes. Broadcasts the
63 static void NotifySSLInternalStateChanged(BrowserContext* context); 62 // SSL_INTERNAL_STATE_CHANGED notification.
63 static void NotifySSLInternalStateChanged(
64 NavigationControllerImpl* controller);
64 65
65 // Construct an SSLManager for the specified tab. 66 // Construct an SSLManager for the specified tab.
66 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. 67 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used.
67 explicit SSLManager(NavigationControllerImpl* controller); 68 explicit SSLManager(NavigationControllerImpl* controller);
68 virtual ~SSLManager(); 69 virtual ~SSLManager();
69 70
70 SSLPolicy* policy() { return policy_.get(); } 71 SSLPolicy* policy() { return policy_.get(); }
71 SSLPolicyBackend* backend() { return &backend_; } 72 SSLPolicyBackend* backend() { return &backend_; }
72 73
73 // The navigation controller associated with this SSLManager. The 74 // The navigation controller associated with this SSLManager. The
74 // NavigationController is guaranteed to outlive the SSLManager. 75 // NavigationController is guaranteed to outlive the SSLManager.
75 NavigationControllerImpl* controller() { return controller_; } 76 NavigationControllerImpl* controller() { return controller_; }
76 77
77 // This entry point is called directly (instead of via the notification 78 // This entry point is called directly (instead of via the notification
78 // service) because we need more precise control of the order in which folks 79 // service) because we need more precise control of the order in which folks
79 // are notified of this event. 80 // are notified of this event.
80 void DidCommitProvisionalLoad(const NotificationDetails& details); 81 void DidCommitProvisionalLoad(const NotificationDetails& details);
81 82
82 // Insecure content entry point. 83 // Insecure content entry point.
83 void DidDisplayInsecureContent();
84 void DidRunInsecureContent(const std::string& security_origin); 84 void DidRunInsecureContent(const std::string& security_origin);
85 85
86 // Entry point for navigation. This function begins the process of updating 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. 87 // the security UI when the main frame navigates to a new URL.
88 // 88 //
89 // Called on the UI thread. 89 // Called on the UI thread.
90 virtual void Observe(int type, 90 virtual void Observe(int type,
91 const NotificationSource& source, 91 const NotificationSource& source,
92 const NotificationDetails& details) OVERRIDE; 92 const NotificationDetails& details) OVERRIDE;
93 93
94 private: 94 private:
95 // Entry points for notifications to which we subscribe. Note that 95 // Entry points for notifications to which we subscribe. Note that
96 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since 96 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since
97 // the type we need is in NavigationController which would create a circular 97 // the type we need is in NavigationController which would create a circular
98 // header file dependency. 98 // header file dependency.
99 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); 99 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details);
100 void DidStartResourceResponse(ResourceRequestDetails* details); 100 void DidStartResourceResponse(ResourceRequestDetails* details);
101 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); 101 void DidReceiveResourceRedirect(ResourceRedirectDetails* details);
102 void DidChangeSSLInternalState();
102 103
103 // Update the NavigationEntry with our current state. 104 // Update the NavigationEntry with our current state.
104 void UpdateEntry(NavigationEntryImpl* entry); 105 void UpdateEntry(NavigationEntryImpl* entry);
105 106
106 // The backend for the SSLPolicy to actuate its decisions. 107 // The backend for the SSLPolicy to actuate its decisions.
107 SSLPolicyBackend backend_; 108 SSLPolicyBackend backend_;
108 109
109 // The SSLPolicy instance for this manager. 110 // The SSLPolicy instance for this manager.
110 scoped_ptr<SSLPolicy> policy_; 111 scoped_ptr<SSLPolicy> policy_;
111 112
112 // The NavigationController that owns this SSLManager. We are responsible 113 // The NavigationController that owns this SSLManager. We are responsible
113 // for the security UI of this tab. 114 // for the security UI of this tab.
114 NavigationControllerImpl* controller_; 115 NavigationControllerImpl* controller_;
115 116
116 // Handles registering notifications with the NotificationService. 117 // Handles registering notifications with the NotificationService.
117 NotificationRegistrar registrar_; 118 NotificationRegistrar registrar_;
118 119
119 DISALLOW_COPY_AND_ASSIGN(SSLManager); 120 DISALLOW_COPY_AND_ASSIGN(SSLManager);
120 }; 121 };
121 122
122 } // namespace content 123 } // namespace content
123 124
124 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_ 125 #endif // CONTENT_BROWSER_SSL_SSL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698