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 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // lookups using GetWebsiteSetting (because Wildcard matches everything) but | 102 // lookups using GetWebsiteSetting (because Wildcard matches everything) but |
103 // it has an impact when trying to change the existing content setting. We | 103 // it has an impact when trying to change the existing content setting. We |
104 // need to migrate the old-format keys. | 104 // need to migrate the old-format keys. |
105 // TODO(raymes): Remove this after ~M51 when clients have migrated. We should | 105 // TODO(raymes): Remove this after ~M51 when clients have migrated. We should |
106 // leave in some code to remove old-format settings for a long time. | 106 // leave in some code to remove old-format settings for a long time. |
107 // crbug.com/569734. | 107 // crbug.com/569734. |
108 ContentSettingsForOneType settings; | 108 ContentSettingsForOneType settings; |
109 map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 109 map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
110 std::string(), &settings); | 110 std::string(), &settings); |
111 for (const ContentSettingPatternSource& setting : settings) { | 111 for (const ContentSettingPatternSource& setting : settings) { |
| 112 // Migrate user preference settings only. |
| 113 if (setting.source != "preference") |
| 114 continue; |
112 // Migrate old-format settings only. | 115 // Migrate old-format settings only. |
113 if (setting.secondary_pattern != ContentSettingsPattern::Wildcard()) { | 116 if (setting.secondary_pattern != ContentSettingsPattern::Wildcard()) { |
114 GURL url(setting.primary_pattern.ToString()); | 117 GURL url(setting.primary_pattern.ToString()); |
115 // Pull out the value of the old-format setting. Only do this if the | 118 // Pull out the value of the old-format setting. Only do this if the |
116 // patterns are as we expect them to be, otherwise the setting will just | 119 // patterns are as we expect them to be, otherwise the setting will just |
117 // be removed for safety. | 120 // be removed for safety. |
118 scoped_ptr<base::Value> value; | 121 scoped_ptr<base::Value> value; |
119 if (setting.primary_pattern == setting.secondary_pattern && | 122 if (setting.primary_pattern == setting.secondary_pattern && |
120 url.is_valid()) { | 123 url.is_valid()) { |
121 value = map->GetWebsiteSetting(url, url, | 124 value = map->GetWebsiteSetting(url, url, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 440 } |
438 | 441 |
439 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( | 442 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( |
440 const std::string& host, | 443 const std::string& host, |
441 int pid) const { | 444 int pid) const { |
442 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); | 445 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); |
443 } | 446 } |
444 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { | 447 void ChromeSSLHostStateDelegate::SetClock(scoped_ptr<base::Clock> clock) { |
445 clock_.reset(clock.release()); | 448 clock_.reset(clock.release()); |
446 } | 449 } |
OLD | NEW |