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> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 url, GURL(), CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 138 url, GURL(), CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
139 std::string(), std::move(value)); | 139 std::string(), std::move(value)); |
140 } | 140 } |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 bool HostFilterToPatternFilter( | 145 bool HostFilterToPatternFilter( |
146 const base::Callback<bool(const std::string&)>& host_filter, | 146 const base::Callback<bool(const std::string&)>& host_filter, |
147 const ContentSettingsPattern& primary_pattern, | 147 const ContentSettingsPattern& primary_pattern, |
148 const ContentSettingsPattern& secondary_pattern) { | 148 const ContentSettingsPattern& secondary_pattern, |
| 149 base::Time last_modified) { |
149 // We only ever set origin-scoped exceptions which are of the form | 150 // We only ever set origin-scoped exceptions which are of the form |
150 // "https://<host>:443". That is a valid URL, so we can compare |host_filter| | 151 // "https://<host>:443". That is a valid URL, so we can compare |host_filter| |
151 // against its host. | 152 // against its host. |
152 GURL url = GURL(primary_pattern.ToString()); | 153 GURL url = GURL(primary_pattern.ToString()); |
153 DCHECK(url.is_valid()); | 154 DCHECK(url.is_valid()); |
154 return host_filter.Run(url.host()); | 155 return host_filter.Run(url.host()); |
155 } | 156 } |
156 | 157 |
157 } // namespace | 158 } // namespace |
158 | 159 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 328 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
328 std::string(), std::move(value)); | 329 std::string(), std::move(value)); |
329 } | 330 } |
330 | 331 |
331 void ChromeSSLHostStateDelegate::Clear( | 332 void ChromeSSLHostStateDelegate::Clear( |
332 const base::Callback<bool(const std::string&)>& host_filter) { | 333 const base::Callback<bool(const std::string&)>& host_filter) { |
333 // Convert host matching to content settings pattern matching. Content | 334 // Convert host matching to content settings pattern matching. Content |
334 // settings deletion is done synchronously on the UI thread, so we can use | 335 // settings deletion is done synchronously on the UI thread, so we can use |
335 // |host_filter| by reference. | 336 // |host_filter| by reference. |
336 base::Callback<bool(const ContentSettingsPattern& primary_pattern, | 337 base::Callback<bool(const ContentSettingsPattern& primary_pattern, |
337 const ContentSettingsPattern& secondary_pattern)> | 338 const ContentSettingsPattern& secondary_pattern, |
| 339 base::Time last_modified)> |
338 pattern_filter; | 340 pattern_filter; |
339 if (!host_filter.is_null()) { | 341 if (!host_filter.is_null()) { |
340 pattern_filter = | 342 pattern_filter = |
341 base::Bind(&HostFilterToPatternFilter, base::ConstRef(host_filter)); | 343 base::Bind(&HostFilterToPatternFilter, base::ConstRef(host_filter)); |
342 } | 344 } |
343 | 345 |
344 HostContentSettingsMapFactory::GetForProfile(profile_) | 346 HostContentSettingsMapFactory::GetForProfile(profile_) |
345 ->ClearSettingsForOneTypeWithPredicate( | 347 ->ClearSettingsForOneTypeWithPredicate( |
346 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, pattern_filter); | 348 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, pattern_filter); |
347 } | 349 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 case CERT_ERRORS_CONTENT: | 489 case CERT_ERRORS_CONTENT: |
488 return !!ran_content_with_cert_errors_hosts_.count( | 490 return !!ran_content_with_cert_errors_hosts_.count( |
489 BrokenHostEntry(host, child_id)); | 491 BrokenHostEntry(host, child_id)); |
490 } | 492 } |
491 NOTREACHED(); | 493 NOTREACHED(); |
492 return false; | 494 return false; |
493 } | 495 } |
494 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { | 496 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { |
495 clock_ = std::move(clock); | 497 clock_ = std::move(clock); |
496 } | 498 } |
OLD | NEW |