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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_ssl_helper.cc

Issue 8356010: Merge 106270 - Check for default content settings when requiring user authorization for plug-ins. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/912/src
Patch Set: fix Created 9 years, 2 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) 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 "chrome/browser/tab_contents/tab_contents_ssl_helper.h" 5 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void TabContentsSSLHelper::SelectClientCertificate( 206 void TabContentsSSLHelper::SelectClientCertificate(
207 scoped_refptr<SSLClientAuthHandler> handler) { 207 scoped_refptr<SSLClientAuthHandler> handler) {
208 net::SSLCertRequestInfo* cert_request_info = handler->cert_request_info(); 208 net::SSLCertRequestInfo* cert_request_info = handler->cert_request_info();
209 GURL requesting_url("https://" + cert_request_info->host_and_port); 209 GURL requesting_url("https://" + cert_request_info->host_and_port);
210 DCHECK(requesting_url.is_valid()) << "Invalid URL string: https://" 210 DCHECK(requesting_url.is_valid()) << "Invalid URL string: https://"
211 << cert_request_info->host_and_port; 211 << cert_request_info->host_and_port;
212 212
213 HostContentSettingsMap* map = 213 HostContentSettingsMap* map =
214 tab_contents_->profile()->GetHostContentSettingsMap(); 214 tab_contents_->profile()->GetHostContentSettingsMap();
215 scoped_ptr<Value> filter(map->GetContentSettingValue( 215 scoped_ptr<Value> filter(map->GetContentSettingValue(
216 requesting_url, 216 requesting_url, requesting_url,
217 requesting_url,
218 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 217 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
219 std::string())); 218 std::string(),
219 NULL, NULL));
220 220
221 scoped_refptr<net::X509Certificate> selected_cert; 221 scoped_refptr<net::X509Certificate> selected_cert;
222 if (filter.get()) { 222 if (filter.get()) {
223 // Try to automatically select a client certificate. 223 // Try to automatically select a client certificate.
224 DCHECK(filter->IsType(Value::TYPE_DICTIONARY)); 224 if (filter->IsType(Value::TYPE_DICTIONARY)) {
225 DictionaryValue* filter_dict = static_cast<DictionaryValue*>(filter.get()); 225 DictionaryValue* filter_dict =
226 static_cast<DictionaryValue*>(filter.get());
226 227
227 const std::vector<scoped_refptr<net::X509Certificate> >& all_client_certs = 228 const std::vector<scoped_refptr<net::X509Certificate> >&
228 cert_request_info->client_certs; 229 all_client_certs = cert_request_info->client_certs;
229 for (size_t i = 0; i < all_client_certs.size(); ++i) { 230 for (size_t i = 0; i < all_client_certs.size(); ++i) {
230 if (CertMatchesFilter(*all_client_certs[i], *filter_dict)) { 231 if (CertMatchesFilter(*all_client_certs[i], *filter_dict)) {
231 selected_cert = all_client_certs[i]; 232 selected_cert = all_client_certs[i];
232 // Use the first certificate that is matched by the filter. 233 // Use the first certificate that is matched by the filter.
233 break; 234 break;
235 }
234 } 236 }
237 } else {
238 NOTREACHED();
235 } 239 }
236 } 240 }
237 241
238 if (selected_cert) { 242 if (selected_cert) {
239 handler->CertificateSelected(selected_cert); 243 handler->CertificateSelected(selected_cert);
240 } else { 244 } else {
241 ShowClientCertificateRequestDialog(handler); 245 ShowClientCertificateRequestDialog(handler);
242 } 246 }
243 } 247 }
244 248
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData( 299 TabContentsSSLHelper::SSLAddCertData* TabContentsSSLHelper::GetAddCertData(
296 SSLAddCertHandler* handler) { 300 SSLAddCertHandler* handler) {
297 // Find/create the slot. 301 // Find/create the slot.
298 linked_ptr<SSLAddCertData>& ptr_ref = 302 linked_ptr<SSLAddCertData>& ptr_ref =
299 request_id_to_add_cert_data_[handler->network_request_id()]; 303 request_id_to_add_cert_data_[handler->network_request_id()];
300 // Fill it if necessary. 304 // Fill it if necessary.
301 if (!ptr_ref.get()) 305 if (!ptr_ref.get())
302 ptr_ref.reset(new SSLAddCertData(tab_contents_)); 306 ptr_ref.reset(new SSLAddCertData(tab_contents_));
303 return ptr_ref.get(); 307 return ptr_ref.get();
304 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.cc ('k') | chrome/common/content_settings_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698