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

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

Issue 8956059: Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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/ssl/ssl_policy.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/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.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"
11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
12 #include "content/browser/renderer_host/resource_request_details.h" 12 #include "content/browser/renderer_host/resource_request_details.h"
13 #include "content/browser/ssl/ssl_cert_error_handler.h" 13 #include "content/browser/ssl/ssl_cert_error_handler.h"
14 #include "content/browser/ssl/ssl_policy.h" 14 #include "content/browser/ssl/ssl_policy.h"
15 #include "content/browser/ssl/ssl_request_info.h" 15 #include "content/browser/ssl/ssl_request_info.h"
16 #include "content/browser/tab_contents/navigation_entry.h" 16 #include "content/browser/tab_contents/navigation_entry_impl.h"
17 #include "content/browser/tab_contents/provisional_load_details.h" 17 #include "content/browser/tab_contents/provisional_load_details.h"
18 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/navigation_details.h" 20 #include "content/public/browser/navigation_details.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_source.h" 22 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/ssl_status.h" 23 #include "content/public/browser/ssl_status.h"
24 #include "net/base/cert_status_flags.h" 24 #include "net/base/cert_status_flags.h"
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 using content::NavigationEntry;
28 using content::NavigationEntryImpl;
27 using content::SSLStatus; 29 using content::SSLStatus;
28 using content::WebContents; 30 using content::WebContents;
29 31
30 // static 32 // static
31 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh, 33 void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
32 net::URLRequest* request, 34 net::URLRequest* request,
33 const net::SSLInfo& ssl_info, 35 const net::SSLInfo& ssl_info,
34 bool is_hsts_host) { 36 bool is_hsts_host) {
35 DVLOG(1) << "OnSSLCertificateError() cert_error: " 37 DVLOG(1) << "OnSSLCertificateError() cert_error: "
36 << net::MapCertStatusToNetError(ssl_info.cert_status) 38 << net::MapCertStatusToNetError(ssl_info.cert_status)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 125 }
124 126
125 SSLManager::~SSLManager() { 127 SSLManager::~SSLManager() {
126 } 128 }
127 129
128 void SSLManager::DidCommitProvisionalLoad( 130 void SSLManager::DidCommitProvisionalLoad(
129 const content::NotificationDetails& in_details) { 131 const content::NotificationDetails& in_details) {
130 content::LoadCommittedDetails* details = 132 content::LoadCommittedDetails* details =
131 content::Details<content::LoadCommittedDetails>(in_details).ptr(); 133 content::Details<content::LoadCommittedDetails>(in_details).ptr();
132 134
133 NavigationEntry* entry = 135 NavigationEntryImpl* entry =
134 NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()); 136 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry());
135 137
136 if (details->is_main_frame) { 138 if (details->is_main_frame) {
137 if (entry) { 139 if (entry) {
138 // Decode the security details. 140 // Decode the security details.
139 int ssl_cert_id; 141 int ssl_cert_id;
140 net::CertStatus ssl_cert_status; 142 net::CertStatus ssl_cert_status;
141 int ssl_security_bits; 143 int ssl_security_bits;
142 int ssl_connection_status; 144 int ssl_connection_status;
143 DeserializeSecurityInfo(details->serialized_security_info, 145 DeserializeSecurityInfo(details->serialized_security_info,
144 &ssl_cert_id, 146 &ssl_cert_id,
145 &ssl_cert_status, 147 &ssl_cert_status,
146 &ssl_security_bits, 148 &ssl_security_bits,
147 &ssl_connection_status); 149 &ssl_connection_status);
148 150
149 // We may not have an entry if this is a navigation to an initial blank 151 // We may not have an entry if this is a navigation to an initial blank
150 // page. Reset the SSL information and add the new data we have. 152 // page. Reset the SSL information and add the new data we have.
151 entry->GetSSL() = SSLStatus(); 153 entry->GetSSL() = SSLStatus();
152 entry->GetSSL().cert_id = ssl_cert_id; 154 entry->GetSSL().cert_id = ssl_cert_id;
153 entry->GetSSL().cert_status = ssl_cert_status; 155 entry->GetSSL().cert_status = ssl_cert_status;
154 entry->GetSSL().security_bits = ssl_security_bits; 156 entry->GetSSL().security_bits = ssl_security_bits;
155 entry->GetSSL().connection_status = ssl_connection_status; 157 entry->GetSSL().connection_status = ssl_connection_status;
156 } 158 }
157 } 159 }
158 160
159 UpdateEntry(entry); 161 UpdateEntry(entry);
160 } 162 }
161 163
162 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { 164 void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
163 policy()->DidRunInsecureContent( 165 policy()->DidRunInsecureContent(
164 NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()), 166 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()),
165 security_origin); 167 security_origin);
166 } 168 }
167 169
168 bool SSLManager::ProcessedSSLErrorFromRequest() const { 170 bool SSLManager::ProcessedSSLErrorFromRequest() const {
169 content::NavigationEntry* entry = controller_->GetActiveEntry(); 171 NavigationEntry* entry = controller_->GetActiveEntry();
170 if (!entry) { 172 if (!entry) {
171 NOTREACHED(); 173 NOTREACHED();
172 return false; 174 return false;
173 } 175 }
174 176
175 return net::IsCertStatusError(entry->GetSSL().cert_status); 177 return net::IsCertStatusError(entry->GetSSL().cert_status);
176 } 178 }
177 179
178 void SSLManager::Observe(int type, 180 void SSLManager::Observe(int type,
179 const content::NotificationSource& source, 181 const content::NotificationSource& source,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) { 239 void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) {
238 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a 240 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a
239 // non-HTTPS resource in the redirect chain, we want to trigger 241 // non-HTTPS resource in the redirect chain, we want to trigger
240 // insecure content, even if the redirect chain goes back to 242 // insecure content, even if the redirect chain goes back to
241 // HTTPS. This is because the network attacker can redirect the 243 // HTTPS. This is because the network attacker can redirect the
242 // HTTP request to https://attacker.com/payload.js. 244 // HTTP request to https://attacker.com/payload.js.
243 } 245 }
244 246
245 void SSLManager::DidChangeSSLInternalState() { 247 void SSLManager::DidChangeSSLInternalState() {
246 UpdateEntry( 248 UpdateEntry(
247 NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry())); 249 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()));
248 } 250 }
249 251
250 void SSLManager::UpdateEntry(NavigationEntry* entry) { 252 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) {
251 // We don't always have a navigation entry to update, for example in the 253 // We don't always have a navigation entry to update, for example in the
252 // case of the Web Inspector. 254 // case of the Web Inspector.
253 if (!entry) 255 if (!entry)
254 return; 256 return;
255 257
256 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! 258 SSLStatus original_ssl_status = entry->GetSSL(); // Copy!
257 259
258 policy()->UpdateEntry(entry, controller_->tab_contents()); 260 policy()->UpdateEntry(entry, controller_->tab_contents());
259 261
260 if (!entry->GetSSL().Equals(original_ssl_status)) { 262 if (!entry->GetSSL().Equals(original_ssl_status)) {
261 content::NotificationService::current()->Notify( 263 content::NotificationService::current()->Notify(
262 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, 264 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
263 content::Source<NavigationController>(controller_), 265 content::Source<NavigationController>(controller_),
264 content::NotificationService::NoDetails()); 266 content::NotificationService::NoDetails());
265 } 267 }
266 } 268 }
OLDNEW
« no previous file with comments | « content/browser/ssl/ssl_manager.h ('k') | content/browser/ssl/ssl_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698