| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // This is a helper function that returns the length of time before a | 72 // This is a helper function that returns the length of time before a |
| 73 // certificate decision expires based on the command line flags. Returns a | 73 // certificate decision expires based on the command line flags. Returns a |
| 74 // non-negative value in seconds or a value of -1 indicating that decisions | 74 // non-negative value in seconds or a value of -1 indicating that decisions |
| 75 // should not be remembered after the current session has ended (but should be | 75 // should not be remembered after the current session has ended (but should be |
| 76 // remembered indefinitely as long as the session does not end), which is the | 76 // remembered indefinitely as long as the session does not end), which is the |
| 77 // "old" style of certificate decision memory. Uses the experimental group | 77 // "old" style of certificate decision memory. Uses the experimental group |
| 78 // unless overridden by a command line flag. | 78 // unless overridden by a command line flag. |
| 79 int64 GetExpirationDelta() { | 79 int64 GetExpirationDelta() { |
| 80 // Check command line flags first to give them priority, then check | 80 // Check command line flags first to give them priority, then check |
| 81 // experimental groups. | 81 // experimental groups. |
| 82 if (CommandLine::ForCurrentProcess()->HasSwitch( | 82 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 83 switches::kRememberCertErrorDecisions)) { | 83 switches::kRememberCertErrorDecisions)) { |
| 84 std::string switch_value = | 84 std::string switch_value = |
| 85 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 85 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 86 switches::kRememberCertErrorDecisions); | 86 switches::kRememberCertErrorDecisions); |
| 87 int64 expiration_delta; | 87 int64 expiration_delta; |
| 88 if (!base::StringToInt64(base::StringPiece(switch_value), | 88 if (!base::StringToInt64(base::StringPiece(switch_value), |
| 89 &expiration_delta) || | 89 &expiration_delta) || |
| 90 expiration_delta < kForgetAtSessionEndSwitchValue) { | 90 expiration_delta < kForgetAtSessionEndSwitchValue) { |
| 91 LOG(ERROR) << "Failed to parse the certificate error decision " | 91 LOG(ERROR) << "Failed to parse the certificate error decision " |
| 92 << "memory length: " << switch_value; | 92 << "memory length: " << switch_value; |
| 93 return kForgetAtSessionEndSwitchValue; | 93 return kForgetAtSessionEndSwitchValue; |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 431 } |
| 432 | 432 |
| 433 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( | 433 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( |
| 434 const std::string& host, | 434 const std::string& host, |
| 435 int pid) const { | 435 int pid) const { |
| 436 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); | 436 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); |
| 437 } | 437 } |
| 438 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { | 438 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { |
| 439 clock_.reset(clock.release()); | 439 clock_.reset(clock.release()); |
| 440 } | 440 } |
| OLD | NEW |