| 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 "components/content_settings/core/common/content_settings.h" | 5 #include "components/content_settings/core/common/content_settings.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Translate the list above into a map for fast lookup. | 64 // Translate the list above into a map for fast lookup. |
| 65 typedef base::hash_map<int, int> Map; | 65 typedef base::hash_map<int, int> Map; |
| 66 CR_DEFINE_STATIC_LOCAL(Map, kMap, ()); | 66 CR_DEFINE_STATIC_LOCAL(Map, kMap, ()); |
| 67 if (kMap.empty()) { | 67 if (kMap.empty()) { |
| 68 for (size_t i = 0; i < arraysize(kHistogramOrder); ++i) { | 68 for (size_t i = 0; i < arraysize(kHistogramOrder); ++i) { |
| 69 if (kHistogramOrder[i] != CONTENT_SETTINGS_TYPE_DEFAULT) | 69 if (kHistogramOrder[i] != CONTENT_SETTINGS_TYPE_DEFAULT) |
| 70 kMap[kHistogramOrder[i]] = static_cast<int>(i); | 70 kMap[kHistogramOrder[i]] = static_cast<int>(i); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 DCHECK(ContainsKey(kMap, content_setting)); | 74 DCHECK(base::ContainsKey(kMap, content_setting)); |
| 75 *num_values = arraysize(kHistogramOrder); | 75 *num_values = arraysize(kHistogramOrder); |
| 76 return kMap[content_setting]; | 76 return kMap[content_setting]; |
| 77 } | 77 } |
| 78 | 78 |
| 79 ContentSettingPatternSource::ContentSettingPatternSource( | 79 ContentSettingPatternSource::ContentSettingPatternSource( |
| 80 const ContentSettingsPattern& primary_pattern, | 80 const ContentSettingsPattern& primary_pattern, |
| 81 const ContentSettingsPattern& secondary_pattern, | 81 const ContentSettingsPattern& secondary_pattern, |
| 82 ContentSetting setting, | 82 ContentSetting setting, |
| 83 const std::string& source, | 83 const std::string& source, |
| 84 bool incognito) | 84 bool incognito) |
| 85 : primary_pattern(primary_pattern), | 85 : primary_pattern(primary_pattern), |
| 86 secondary_pattern(secondary_pattern), | 86 secondary_pattern(secondary_pattern), |
| 87 setting(setting), | 87 setting(setting), |
| 88 source(source), | 88 source(source), |
| 89 incognito(incognito) {} | 89 incognito(incognito) {} |
| 90 | 90 |
| 91 ContentSettingPatternSource::ContentSettingPatternSource() | 91 ContentSettingPatternSource::ContentSettingPatternSource() |
| 92 : setting(CONTENT_SETTING_DEFAULT), incognito(false) { | 92 : setting(CONTENT_SETTING_DEFAULT), incognito(false) { |
| 93 } | 93 } |
| 94 | 94 |
| 95 ContentSettingPatternSource::ContentSettingPatternSource( | 95 ContentSettingPatternSource::ContentSettingPatternSource( |
| 96 const ContentSettingPatternSource& other) = default; | 96 const ContentSettingPatternSource& other) = default; |
| 97 | 97 |
| 98 RendererContentSettingRules::RendererContentSettingRules() {} | 98 RendererContentSettingRules::RendererContentSettingRules() {} |
| 99 | 99 |
| 100 RendererContentSettingRules::~RendererContentSettingRules() {} | 100 RendererContentSettingRules::~RendererContentSettingRules() {} |
| OLD | NEW |