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

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

Issue 1244863003: Attach a SecurityStyle to each request in ResourceLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out browser test and use another SpawnedTestServer Created 5 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
« 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) 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry(); 114 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry();
115 115
116 if (details.is_main_frame) { 116 if (details.is_main_frame) {
117 if (entry) { 117 if (entry) {
118 // We may not have an entry if this is a navigation to an initial blank 118 // We may not have an entry if this is a navigation to an initial blank
119 // page. Add the new data we have. 119 // page. Add the new data we have.
120 entry->GetSSL() = details.ssl_status; 120 entry->GetSSL() = details.ssl_status;
121 } 121 }
122 } 122 }
123 123
124 UpdateEntry(entry); 124 policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents());
125 // Always notify the WebContents that the SSL state changed when a
126 // load is committed, in case the active navigation entry has changed.
127 NotifyDidChangeVisibleSSLState();
125 } 128 }
126 129
127 void SSLManager::DidDisplayInsecureContent() { 130 void SSLManager::DidDisplayInsecureContent() {
128 UpdateEntry(controller_->GetLastCommittedEntry()); 131 UpdateEntry(controller_->GetLastCommittedEntry());
129 } 132 }
130 133
131 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { 134 void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
132 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); 135 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry();
133 policy()->DidRunInsecureContent(navigation_entry, security_origin); 136 policy()->DidRunInsecureContent(navigation_entry, security_origin);
134 UpdateEntry(navigation_entry); 137 UpdateEntry(navigation_entry);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 180 }
178 181
179 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { 182 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) {
180 // We don't always have a navigation entry to update, for example in the 183 // We don't always have a navigation entry to update, for example in the
181 // case of the Web Inspector. 184 // case of the Web Inspector.
182 if (!entry) 185 if (!entry)
183 return; 186 return;
184 187
185 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! 188 SSLStatus original_ssl_status = entry->GetSSL(); // Copy!
186 189
190 policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents());
191
192 if (!entry->GetSSL().Equals(original_ssl_status))
193 NotifyDidChangeVisibleSSLState();
194 }
195
196 void SSLManager::NotifyDidChangeVisibleSSLState() {
187 WebContentsImpl* contents = 197 WebContentsImpl* contents =
188 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); 198 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents());
189 policy()->UpdateEntry(entry, contents); 199 contents->DidChangeVisibleSSLState();
190
191 if (!entry->GetSSL().Equals(original_ssl_status))
192 contents->DidChangeVisibleSSLState();
193 } 200 }
194 201
195 } // namespace content 202 } // namespace content
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