| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting, | 73 int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting, |
| 74 size_t* num_values) { | 74 size_t* num_values) { |
| 75 *num_values = arraysize(kHistogramValue); | 75 *num_values = arraysize(kHistogramValue); |
| 76 | 76 |
| 77 // Verify the array is sorted by enum type and contains all values. | 77 // Verify the array is sorted by enum type and contains all values. |
| 78 DCHECK(std::is_sorted(std::begin(kHistogramValue), std::end(kHistogramValue), | 78 DCHECK(std::is_sorted(std::begin(kHistogramValue), std::end(kHistogramValue), |
| 79 [](const HistogramValue& a, const HistogramValue& b) { | 79 [](const HistogramValue& a, const HistogramValue& b) { |
| 80 return a.type < b.type; | 80 return a.type < b.type; |
| 81 })); | 81 })); |
| 82 static_assert(kHistogramValue[kNumHistogramValues - 1].type == | 82 static_assert(kHistogramValue[kNumHistogramValues - 1].type == |
| 83 CONTENT_SETTINGS_NUM_TYPES_DO_NOT_USE - 1, | 83 CONTENT_SETTINGS_NUM_TYPES - 1, |
| 84 "Update content settings histogram lookup"); | 84 "Update content settings histogram lookup"); |
| 85 | 85 |
| 86 const HistogramValue* found = std::lower_bound( | 86 const HistogramValue* found = std::lower_bound( |
| 87 std::begin(kHistogramValue), std::end(kHistogramValue), content_setting, | 87 std::begin(kHistogramValue), std::end(kHistogramValue), content_setting, |
| 88 [](const HistogramValue& a, ContentSettingsType b) { | 88 [](const HistogramValue& a, ContentSettingsType b) { |
| 89 return a.type < b; | 89 return a.type < b; |
| 90 }); | 90 }); |
| 91 if (found != std::end(kHistogramValue) && found->type == content_setting) | 91 if (found != std::end(kHistogramValue) && found->type == content_setting) |
| 92 return found->value; | 92 return found->value; |
| 93 NOTREACHED(); | 93 NOTREACHED(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 ContentSettingPatternSource::~ContentSettingPatternSource() {} | 127 ContentSettingPatternSource::~ContentSettingPatternSource() {} |
| 128 | 128 |
| 129 ContentSetting ContentSettingPatternSource::GetContentSetting() const { | 129 ContentSetting ContentSettingPatternSource::GetContentSetting() const { |
| 130 return content_settings::ValueToContentSetting(setting_value.get()); | 130 return content_settings::ValueToContentSetting(setting_value.get()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 RendererContentSettingRules::RendererContentSettingRules() {} | 133 RendererContentSettingRules::RendererContentSettingRules() {} |
| 134 | 134 |
| 135 RendererContentSettingRules::~RendererContentSettingRules() {} | 135 RendererContentSettingRules::~RendererContentSettingRules() {} |
| OLD | NEW |