| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/content_settings_registry.h" | 5 #include "components/content_settings/core/browser/content_settings_registry.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/content_settings/core/browser/content_settings_utils.h" | 10 #include "components/content_settings/core/browser/content_settings_utils.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ContentSettingsRegistry::~ContentSettingsRegistry() {} | 85 ContentSettingsRegistry::~ContentSettingsRegistry() {} |
| 86 | 86 |
| 87 const ContentSettingsInfo* ContentSettingsRegistry::Get( | 87 const ContentSettingsInfo* ContentSettingsRegistry::Get( |
| 88 ContentSettingsType type) const { | 88 ContentSettingsType type) const { |
| 89 const auto& it = content_settings_info_.find(type); | 89 const auto& it = content_settings_info_.find(type); |
| 90 if (it != content_settings_info_.end()) | 90 if (it != content_settings_info_.end()) |
| 91 return it->second; | 91 return it->second; |
| 92 return nullptr; | 92 return nullptr; |
| 93 } | 93 } |
| 94 | 94 |
| 95 ContentSettingsRegistry::const_iterator ContentSettingsRegistry::begin() const { |
| 96 return const_iterator(content_settings_info_.begin()); |
| 97 } |
| 98 |
| 99 ContentSettingsRegistry::const_iterator ContentSettingsRegistry::end() const { |
| 100 return const_iterator(content_settings_info_.end()); |
| 101 } |
| 102 |
| 95 void ContentSettingsRegistry::Init() { | 103 void ContentSettingsRegistry::Init() { |
| 96 // TODO(raymes): This registration code should not have to be in a single | 104 // TODO(raymes): This registration code should not have to be in a single |
| 97 // location. It should be possible to register a setting from the code | 105 // location. It should be possible to register a setting from the code |
| 98 // associated with it. | 106 // associated with it. |
| 99 | 107 |
| 100 // WARNING: The string names of the permissions passed in below are used to | 108 // WARNING: The string names of the permissions passed in below are used to |
| 101 // generate preference names and should never be changed! | 109 // generate preference names and should never be changed! |
| 102 | 110 |
| 103 // Content settings (those with allow/block/ask/etc. values). | 111 // Content settings (those with allow/block/ask/etc. values). |
| 104 Register(CONTENT_SETTINGS_TYPE_COOKIES, "cookies", CONTENT_SETTING_ALLOW, | 112 Register(CONTENT_SETTINGS_TYPE_COOKIES, "cookies", CONTENT_SETTING_ALLOW, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 website_settings_registry_->Register(type, name, default_value.Pass(), | 188 website_settings_registry_->Register(type, name, default_value.Pass(), |
| 181 sync_status, | 189 sync_status, |
| 182 WebsiteSettingsInfo::NOT_LOSSY); | 190 WebsiteSettingsInfo::NOT_LOSSY); |
| 183 DCHECK(!ContainsKey(content_settings_info_, type)); | 191 DCHECK(!ContainsKey(content_settings_info_, type)); |
| 184 content_settings_info_.set( | 192 content_settings_info_.set( |
| 185 type, make_scoped_ptr(new ContentSettingsInfo(website_settings_info, | 193 type, make_scoped_ptr(new ContentSettingsInfo(website_settings_info, |
| 186 whitelisted_schemes))); | 194 whitelisted_schemes))); |
| 187 } | 195 } |
| 188 | 196 |
| 189 } // namespace content_settings | 197 } // namespace content_settings |
| OLD | NEW |