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

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

Issue 23022006: Remove GetActiveEntry usage from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 #include "content/browser/ssl/ssl_manager.h" 5 #include "content/browser/ssl/ssl_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 // static 84 // static
85 void SSLManager::NotifySSLInternalStateChanged(BrowserContext* context) { 85 void SSLManager::NotifySSLInternalStateChanged(BrowserContext* context) {
86 SSLManagerSet* managers = static_cast<SSLManagerSet*>( 86 SSLManagerSet* managers = static_cast<SSLManagerSet*>(
87 context->GetUserData(kSSLManagerKeyName)); 87 context->GetUserData(kSSLManagerKeyName));
88 88
89 for (std::set<SSLManager*>::iterator i = managers->get().begin(); 89 for (std::set<SSLManager*>::iterator i = managers->get().begin();
90 i != managers->get().end(); ++i) { 90 i != managers->get().end(); ++i) {
91 (*i)->UpdateEntry(NavigationEntryImpl::FromNavigationEntry( 91 (*i)->UpdateEntry(NavigationEntryImpl::FromNavigationEntry(
92 (*i)->controller()->GetActiveEntry())); 92 (*i)->controller()->GetLastCommittedEntry()));
Charlie Reis 2013/08/16 22:10:14 I like that we're switching to GetLastCommittedEnt
93 } 93 }
94 } 94 }
95 95
96 SSLManager::SSLManager(NavigationControllerImpl* controller) 96 SSLManager::SSLManager(NavigationControllerImpl* controller)
97 : backend_(controller), 97 : backend_(controller),
98 policy_(new SSLPolicy(&backend_)), 98 policy_(new SSLPolicy(&backend_)),
99 controller_(controller) { 99 controller_(controller) {
100 DCHECK(controller_); 100 DCHECK(controller_);
101 101
102 // Subscribe to various notifications. 102 // Subscribe to various notifications.
(...skipping 21 matching lines...) Expand all
124 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName)); 124 controller_->GetBrowserContext()->GetUserData(kSSLManagerKeyName));
125 managers->get().erase(this); 125 managers->get().erase(this);
126 } 126 }
127 127
128 void SSLManager::DidCommitProvisionalLoad( 128 void SSLManager::DidCommitProvisionalLoad(
129 const NotificationDetails& in_details) { 129 const NotificationDetails& in_details) {
130 LoadCommittedDetails* details = 130 LoadCommittedDetails* details =
131 Details<LoadCommittedDetails>(in_details).ptr(); 131 Details<LoadCommittedDetails>(in_details).ptr();
132 132
133 NavigationEntryImpl* entry = 133 NavigationEntryImpl* entry =
134 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()); 134 NavigationEntryImpl::FromNavigationEntry(
135 controller_->GetLastCommittedEntry());
135 136
136 if (details->is_main_frame) { 137 if (details->is_main_frame) {
137 if (entry) { 138 if (entry) {
138 // Decode the security details. 139 // Decode the security details.
139 int ssl_cert_id; 140 int ssl_cert_id;
140 net::CertStatus ssl_cert_status; 141 net::CertStatus ssl_cert_status;
141 int ssl_security_bits; 142 int ssl_security_bits;
142 int ssl_connection_status; 143 int ssl_connection_status;
143 DeserializeSecurityInfo(details->serialized_security_info, 144 DeserializeSecurityInfo(details->serialized_security_info,
144 &ssl_cert_id, 145 &ssl_cert_id,
145 &ssl_cert_status, 146 &ssl_cert_status,
146 &ssl_security_bits, 147 &ssl_security_bits,
147 &ssl_connection_status); 148 &ssl_connection_status);
148 149
149 // We may not have an entry if this is a navigation to an initial blank 150 // 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. 151 // page. Reset the SSL information and add the new data we have.
151 entry->GetSSL() = SSLStatus(); 152 entry->GetSSL() = SSLStatus();
152 entry->GetSSL().cert_id = ssl_cert_id; 153 entry->GetSSL().cert_id = ssl_cert_id;
153 entry->GetSSL().cert_status = ssl_cert_status; 154 entry->GetSSL().cert_status = ssl_cert_status;
154 entry->GetSSL().security_bits = ssl_security_bits; 155 entry->GetSSL().security_bits = ssl_security_bits;
155 entry->GetSSL().connection_status = ssl_connection_status; 156 entry->GetSSL().connection_status = ssl_connection_status;
156 } 157 }
157 } 158 }
158 159
159 UpdateEntry(entry); 160 UpdateEntry(entry);
160 } 161 }
161 162
162 void SSLManager::DidDisplayInsecureContent() { 163 void SSLManager::DidDisplayInsecureContent() {
163 UpdateEntry( 164 UpdateEntry(
164 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry())); 165 NavigationEntryImpl::FromNavigationEntry(
166 controller_->GetLastCommittedEntry()));
165 } 167 }
166 168
167 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { 169 void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
168 NavigationEntryImpl* navigation_entry = 170 NavigationEntryImpl* navigation_entry =
169 NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()); 171 NavigationEntryImpl::FromNavigationEntry(
172 controller_->GetLastCommittedEntry());
170 policy()->DidRunInsecureContent(navigation_entry, security_origin); 173 policy()->DidRunInsecureContent(navigation_entry, security_origin);
171 UpdateEntry(navigation_entry); 174 UpdateEntry(navigation_entry);
172 } 175 }
173 176
174 void SSLManager::Observe(int type, 177 void SSLManager::Observe(int type,
175 const NotificationSource& source, 178 const NotificationSource& source,
176 const NotificationDetails& details) { 179 const NotificationDetails& details) {
177 // Dispatch by type. 180 // Dispatch by type.
178 switch (type) { 181 switch (type) {
179 case NOTIFICATION_RESOURCE_RESPONSE_STARTED: 182 case NOTIFICATION_RESOURCE_RESPONSE_STARTED:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 243
241 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! 244 SSLStatus original_ssl_status = entry->GetSSL(); // Copy!
242 245
243 policy()->UpdateEntry(entry, controller_->web_contents()); 246 policy()->UpdateEntry(entry, controller_->web_contents());
244 247
245 if (!entry->GetSSL().Equals(original_ssl_status)) 248 if (!entry->GetSSL().Equals(original_ssl_status))
246 controller_->web_contents()->DidChangeVisibleSSLState(); 249 controller_->web_contents()->DidChangeVisibleSSLState();
247 } 250 }
248 251
249 } // namespace content 252 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698