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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | « content/browser/ssl/ssl_manager.h ('k') | content/browser/tab_contents/interstitial_page.h » ('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) 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 #include "content/browser/ssl/ssl_manager.h" 5 #include "content/browser/ssl/ssl_manager.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "content/browser/load_from_memory_cache_details.h" 9 #include "content/browser/load_from_memory_cache_details.h"
10 #include "content/browser/renderer_host/resource_dispatcher_host.h" 10 #include "content/browser/renderer_host/resource_dispatcher_host.h"
(...skipping 29 matching lines...) Expand all
40 request, 40 request,
41 info->resource_type(), 41 info->resource_type(),
42 cert_error, 42 cert_error,
43 cert), 43 cert),
44 &SSLCertErrorHandler::Dispatch)); 44 &SSLCertErrorHandler::Dispatch));
45 } 45 }
46 46
47 // static 47 // static
48 void SSLManager::NotifySSLInternalStateChanged() { 48 void SSLManager::NotifySSLInternalStateChanged() {
49 NotificationService::current()->Notify( 49 NotificationService::current()->Notify(
50 NotificationType::SSL_INTERNAL_STATE_CHANGED, 50 content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
51 NotificationService::AllSources(), 51 NotificationService::AllSources(),
52 NotificationService::NoDetails()); 52 NotificationService::NoDetails());
53 } 53 }
54 54
55 // static 55 // static
56 std::string SSLManager::SerializeSecurityInfo(int cert_id, 56 std::string SSLManager::SerializeSecurityInfo(int cert_id,
57 int cert_status, 57 int cert_status,
58 int security_bits, 58 int security_bits,
59 int ssl_connection_status) { 59 int ssl_connection_status) {
60 Pickle pickle; 60 Pickle pickle;
(...skipping 29 matching lines...) Expand all
90 pickle.ReadInt(&iter, ssl_connection_status); 90 pickle.ReadInt(&iter, ssl_connection_status);
91 } 91 }
92 92
93 SSLManager::SSLManager(NavigationController* controller) 93 SSLManager::SSLManager(NavigationController* controller)
94 : backend_(controller), 94 : backend_(controller),
95 policy_(new SSLPolicy(&backend_)), 95 policy_(new SSLPolicy(&backend_)),
96 controller_(controller) { 96 controller_(controller) {
97 DCHECK(controller_); 97 DCHECK(controller_);
98 98
99 // Subscribe to various notifications. 99 // Subscribe to various notifications.
100 registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, 100 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
101 Source<NavigationController>(controller_)); 101 Source<NavigationController>(controller_));
102 registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED, 102 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED,
103 Source<RenderViewHostDelegate>(controller_->tab_contents())); 103 Source<RenderViewHostDelegate>(controller_->tab_contents()));
104 registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT, 104 registrar_.Add(this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
105 Source<RenderViewHostDelegate>(controller_->tab_contents())); 105 Source<RenderViewHostDelegate>(controller_->tab_contents()));
106 registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE, 106 registrar_.Add(this, content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
107 Source<NavigationController>(controller_)); 107 Source<NavigationController>(controller_));
108 registrar_.Add(this, NotificationType::SSL_INTERNAL_STATE_CHANGED, 108 registrar_.Add(this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED,
109 NotificationService::AllSources()); 109 NotificationService::AllSources());
110 } 110 }
111 111
112 SSLManager::~SSLManager() { 112 SSLManager::~SSLManager() {
113 } 113 }
114 114
115 void SSLManager::DidCommitProvisionalLoad( 115 void SSLManager::DidCommitProvisionalLoad(
116 const NotificationDetails& in_details) { 116 const NotificationDetails& in_details) {
117 content::LoadCommittedDetails* details = 117 content::LoadCommittedDetails* details =
118 Details<content::LoadCommittedDetails>(in_details).ptr(); 118 Details<content::LoadCommittedDetails>(in_details).ptr();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 bool SSLManager::ProcessedSSLErrorFromRequest() const { 151 bool SSLManager::ProcessedSSLErrorFromRequest() const {
152 NavigationEntry* entry = controller_->GetActiveEntry(); 152 NavigationEntry* entry = controller_->GetActiveEntry();
153 if (!entry) { 153 if (!entry) {
154 NOTREACHED(); 154 NOTREACHED();
155 return false; 155 return false;
156 } 156 }
157 157
158 return net::IsCertStatusError(entry->ssl().cert_status()); 158 return net::IsCertStatusError(entry->ssl().cert_status());
159 } 159 }
160 160
161 void SSLManager::Observe(NotificationType type, 161 void SSLManager::Observe(int type,
162 const NotificationSource& source, 162 const NotificationSource& source,
163 const NotificationDetails& details) { 163 const NotificationDetails& details) {
164 // Dispatch by type. 164 // Dispatch by type.
165 switch (type.value) { 165 switch (type) {
166 case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: 166 case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR:
167 // Do nothing. 167 // Do nothing.
168 break; 168 break;
169 case NotificationType::RESOURCE_RESPONSE_STARTED: 169 case content::NOTIFICATION_RESOURCE_RESPONSE_STARTED:
170 DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr()); 170 DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr());
171 break; 171 break;
172 case NotificationType::RESOURCE_RECEIVED_REDIRECT: 172 case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT:
173 DidReceiveResourceRedirect( 173 DidReceiveResourceRedirect(
174 Details<ResourceRedirectDetails>(details).ptr()); 174 Details<ResourceRedirectDetails>(details).ptr());
175 break; 175 break;
176 case NotificationType::LOAD_FROM_MEMORY_CACHE: 176 case content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE:
177 DidLoadFromMemoryCache( 177 DidLoadFromMemoryCache(
178 Details<LoadFromMemoryCacheDetails>(details).ptr()); 178 Details<LoadFromMemoryCacheDetails>(details).ptr());
179 break; 179 break;
180 case NotificationType::SSL_INTERNAL_STATE_CHANGED: 180 case content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED:
181 DidChangeSSLInternalState(); 181 DidChangeSSLInternalState();
182 break; 182 break;
183 default: 183 default:
184 NOTREACHED() << "The SSLManager received an unexpected notification."; 184 NOTREACHED() << "The SSLManager received an unexpected notification.";
185 } 185 }
186 } 186 }
187 187
188 void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { 188 void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) {
189 // Simulate loading this resource through the usual path. 189 // Simulate loading this resource through the usual path.
190 // Note that we specify SUB_RESOURCE as the resource type as WebCore only 190 // Note that we specify SUB_RESOURCE as the resource type as WebCore only
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // case of the Web Inspector. 233 // case of the Web Inspector.
234 if (!entry) 234 if (!entry)
235 return; 235 return;
236 236
237 NavigationEntry::SSLStatus original_ssl_status = entry->ssl(); // Copy! 237 NavigationEntry::SSLStatus original_ssl_status = entry->ssl(); // Copy!
238 238
239 policy()->UpdateEntry(entry, controller_->tab_contents()); 239 policy()->UpdateEntry(entry, controller_->tab_contents());
240 240
241 if (!entry->ssl().Equals(original_ssl_status)) { 241 if (!entry->ssl().Equals(original_ssl_status)) {
242 NotificationService::current()->Notify( 242 NotificationService::current()->Notify(
243 NotificationType::SSL_VISIBLE_STATE_CHANGED, 243 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
244 Source<NavigationController>(controller_), 244 Source<NavigationController>(controller_),
245 NotificationService::NoDetails()); 245 NotificationService::NoDetails());
246 } 246 }
247 } 247 }
OLDNEW
« no previous file with comments | « content/browser/ssl/ssl_manager.h ('k') | content/browser/tab_contents/interstitial_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698