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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/base64.h" | 13 #include "base/base64.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/guid.h" | 17 #include "base/guid.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ptr_util.h" |
19 #include "base/metrics/field_trial.h" | 20 #include "base/metrics/field_trial.h" |
20 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
21 #include "base/time/clock.h" | 22 #include "base/time/clock.h" |
22 #include "base/time/default_clock.h" | 23 #include "base/time/default_clock.h" |
23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
24 #include "base/values.h" | 25 #include "base/values.h" |
25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "components/content_settings/core/browser/host_content_settings_map.h" | 28 #include "components/content_settings/core/browser/host_content_settings_map.h" |
28 #include "components/content_settings/core/common/content_settings_types.h" | 29 #include "components/content_settings/core/common/content_settings_types.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 257 |
257 dict->SetString(kSSLCertDecisionGUIDKey, current_expiration_guid_); | 258 dict->SetString(kSSLCertDecisionGUIDKey, current_expiration_guid_); |
258 | 259 |
259 // Extract the map of certificate fingerprints to errors from the setting. | 260 // Extract the map of certificate fingerprints to errors from the setting. |
260 base::DictionaryValue* cert_error_dict = NULL; // Will be owned by dict | 261 base::DictionaryValue* cert_error_dict = NULL; // Will be owned by dict |
261 if (expired || | 262 if (expired || |
262 !dict->GetDictionary(kSSLCertDecisionCertErrorMapKey, &cert_error_dict)) { | 263 !dict->GetDictionary(kSSLCertDecisionCertErrorMapKey, &cert_error_dict)) { |
263 if (create_entries == DO_NOT_CREATE_DICTIONARY_ENTRIES) | 264 if (create_entries == DO_NOT_CREATE_DICTIONARY_ENTRIES) |
264 return NULL; | 265 return NULL; |
265 | 266 |
266 cert_error_dict = new base::DictionaryValue(); | 267 cert_error_dict = |
267 // dict takes ownership of cert_error_dict | 268 dict->SetDictionary(kSSLCertDecisionCertErrorMapKey, |
268 dict->Set(kSSLCertDecisionCertErrorMapKey, cert_error_dict); | 269 base::MakeUnique<base::DictionaryValue>()); |
269 } | 270 } |
270 | 271 |
271 return cert_error_dict; | 272 return cert_error_dict; |
272 } | 273 } |
273 | 274 |
274 // If |should_remember_ssl_decisions_| is | 275 // If |should_remember_ssl_decisions_| is |
275 // FORGET_SSL_EXCEPTION_DECISIONS_AT_SESSION_END, that means that all invalid | 276 // FORGET_SSL_EXCEPTION_DECISIONS_AT_SESSION_END, that means that all invalid |
276 // certificate proceed decisions should be forgotten when the session ends. To | 277 // certificate proceed decisions should be forgotten when the session ends. To |
277 // simulate that, Chrome keeps track of a guid to represent the current browser | 278 // simulate that, Chrome keeps track of a guid to represent the current browser |
278 // session and stores it in decision entries. See the comment for | 279 // session and stores it in decision entries. See the comment for |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 case CERT_ERRORS_CONTENT: | 487 case CERT_ERRORS_CONTENT: |
487 return !!ran_content_with_cert_errors_hosts_.count( | 488 return !!ran_content_with_cert_errors_hosts_.count( |
488 BrokenHostEntry(host, child_id)); | 489 BrokenHostEntry(host, child_id)); |
489 } | 490 } |
490 NOTREACHED(); | 491 NOTREACHED(); |
491 return false; | 492 return false; |
492 } | 493 } |
493 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { | 494 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { |
494 clock_ = std::move(clock); | 495 clock_ = std::move(clock); |
495 } | 496 } |
OLD | NEW |