| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/content_settings_origin_identifier_val
ue_map.h" | 5 #include "chrome/browser/content_settings/content_settings_origin_identifier_val
ue_map.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/content_settings/content_settings_rule.h" | 10 #include "chrome/browser/content_settings/content_settings_rule.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 OriginIdentifierValueMap::EntryMapKey::EntryMapKey( | 52 OriginIdentifierValueMap::EntryMapKey::EntryMapKey( |
| 53 ContentSettingsType content_type, | 53 ContentSettingsType content_type, |
| 54 ResourceIdentifier resource_identifier) | 54 ResourceIdentifier resource_identifier) |
| 55 : content_type(content_type), | 55 : content_type(content_type), |
| 56 resource_identifier(resource_identifier) { | 56 resource_identifier(resource_identifier) { |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool OriginIdentifierValueMap::EntryMapKey::operator<( | 59 bool OriginIdentifierValueMap::EntryMapKey::operator<( |
| 60 const OriginIdentifierValueMap::EntryMapKey& other) const { | 60 const OriginIdentifierValueMap::EntryMapKey& other) const { |
| 61 if (content_type < other.content_type) | 61 if (content_type != other.content_type) |
| 62 return true; | 62 return content_type < other.content_type; |
| 63 else if (other.content_type > content_type) | |
| 64 return false; | |
| 65 return (resource_identifier < other.resource_identifier); | 63 return (resource_identifier < other.resource_identifier); |
| 66 } | 64 } |
| 67 | 65 |
| 68 OriginIdentifierValueMap::PatternPair::PatternPair( | 66 OriginIdentifierValueMap::PatternPair::PatternPair( |
| 69 ContentSettingsPattern primary_pattern, | 67 ContentSettingsPattern primary_pattern, |
| 70 ContentSettingsPattern secondary_pattern) | 68 ContentSettingsPattern secondary_pattern) |
| 71 : primary_pattern(primary_pattern), | 69 : primary_pattern(primary_pattern), |
| 72 secondary_pattern(secondary_pattern) { | 70 secondary_pattern(secondary_pattern) { |
| 73 } | 71 } |
| 74 | 72 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 OriginIdentifierValueMap::EntryMap::iterator OriginIdentifierValueMap::erase( | 162 OriginIdentifierValueMap::EntryMap::iterator OriginIdentifierValueMap::erase( |
| 165 OriginIdentifierValueMap::EntryMap::iterator entry) { | 163 OriginIdentifierValueMap::EntryMap::iterator entry) { |
| 166 // Erasing from the map doesn't invalidate other iterators than the erased | 164 // Erasing from the map doesn't invalidate other iterators than the erased |
| 167 // one. | 165 // one. |
| 168 OriginIdentifierValueMap::EntryMap::iterator to_erase = entry++; | 166 OriginIdentifierValueMap::EntryMap::iterator to_erase = entry++; |
| 169 entries_.erase(to_erase); | 167 entries_.erase(to_erase); |
| 170 return entry; | 168 return entry; |
| 171 } | 169 } |
| 172 | 170 |
| 173 } // namespace content_settings | 171 } // namespace content_settings |
| OLD | NEW |