OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ssl/chrome_ssl_host_state_delegate.h" | 5 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 content::SSLHostStateDelegate::CertJudgment | 320 content::SSLHostStateDelegate::CertJudgment |
321 ChromeSSLHostStateDelegate::QueryPolicy(const std::string& host, | 321 ChromeSSLHostStateDelegate::QueryPolicy(const std::string& host, |
322 const net::X509Certificate& cert, | 322 const net::X509Certificate& cert, |
323 net::CertStatus error, | 323 net::CertStatus error, |
324 bool* expired_previous_decision) { | 324 bool* expired_previous_decision) { |
325 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); | 325 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); |
326 GURL url = GetSecureGURLForHost(host); | 326 GURL url = GetSecureGURLForHost(host); |
327 scoped_ptr<base::Value> value(map->GetWebsiteSetting( | 327 scoped_ptr<base::Value> value(map->GetWebsiteSetting( |
328 url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), NULL)); | 328 url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), NULL)); |
329 | 329 |
330 // We always let certificate errors on localhost through; they are | |
felt
2015/02/03 06:23:17
nit: Given that "we" can sometimes be ambiguous, a
estark
2015/02/03 22:42:09
Done.
| |
331 // unlikely to indicate actual security problems. | |
332 bool allowLocalhost = base::CommandLine::ForCurrentProcess()-> | |
333 HasSwitch(switches::kAllowInsecureLocalhost); | |
334 if (allowLocalhost && url.DomainIs("localhost")) { | |
335 return ALLOWED; | |
336 } | |
337 | |
330 // Set a default value in case this method is short circuited and doesn't do a | 338 // Set a default value in case this method is short circuited and doesn't do a |
331 // full query. | 339 // full query. |
332 *expired_previous_decision = false; | 340 *expired_previous_decision = false; |
333 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) | 341 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) |
334 return DENIED; | 342 return DENIED; |
335 | 343 |
336 base::DictionaryValue* dict; // Owned by value | 344 base::DictionaryValue* dict; // Owned by value |
337 int policy_decision; | 345 int policy_decision; |
338 bool success = value->GetAsDictionary(&dict); | 346 bool success = value->GetAsDictionary(&dict); |
339 DCHECK(success); | 347 DCHECK(success); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 } | 439 } |
432 | 440 |
433 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( | 441 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( |
434 const std::string& host, | 442 const std::string& host, |
435 int pid) const { | 443 int pid) const { |
436 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); | 444 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); |
437 } | 445 } |
438 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { | 446 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { |
439 clock_.reset(clock.release()); | 447 clock_.reset(clock.release()); |
440 } | 448 } |
OLD | NEW |