| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_utils.h" | 5 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const char kPatternSeparator[] = ","; | 55 const char kPatternSeparator[] = ","; |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 namespace content_settings { | 59 namespace content_settings { |
| 60 | 60 |
| 61 std::string GetTypeName(ContentSettingsType type) { | 61 std::string GetTypeName(ContentSettingsType type) { |
| 62 return std::string(kTypeNames[type]); | 62 return std::string(kTypeNames[type]); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool GetTypeFromName(const std::string& name, | |
| 66 ContentSettingsType* return_setting) { | |
| 67 for (size_t type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | |
| 68 if (name.compare(kTypeNames[type]) == 0) { | |
| 69 *return_setting = static_cast<ContentSettingsType>(type); | |
| 70 return true; | |
| 71 } | |
| 72 } | |
| 73 return false; | |
| 74 } | |
| 75 | |
| 76 std::string ContentSettingToString(ContentSetting setting) { | 65 std::string ContentSettingToString(ContentSetting setting) { |
| 77 switch (setting) { | 66 switch (setting) { |
| 78 case CONTENT_SETTING_ALLOW: | 67 case CONTENT_SETTING_ALLOW: |
| 79 return "allow"; | 68 return "allow"; |
| 80 case CONTENT_SETTING_ASK: | 69 case CONTENT_SETTING_ASK: |
| 81 return "ask"; | 70 return "ask"; |
| 82 case CONTENT_SETTING_BLOCK: | 71 case CONTENT_SETTING_BLOCK: |
| 83 return "block"; | 72 return "block"; |
| 84 case CONTENT_SETTING_SESSION_ONLY: | 73 case CONTENT_SETTING_SESSION_ONLY: |
| 85 return "session"; | 74 return "session"; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 CONTENT_SETTINGS_TYPE_IMAGES, | 221 CONTENT_SETTINGS_TYPE_IMAGES, |
| 233 ResourceIdentifier(), | 222 ResourceIdentifier(), |
| 234 &(rules->image_rules)); | 223 &(rules->image_rules)); |
| 235 map->GetSettingsForOneType( | 224 map->GetSettingsForOneType( |
| 236 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 225 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 237 ResourceIdentifier(), | 226 ResourceIdentifier(), |
| 238 &(rules->script_rules)); | 227 &(rules->script_rules)); |
| 239 } | 228 } |
| 240 | 229 |
| 241 } // namespace content_settings | 230 } // namespace content_settings |
| OLD | NEW |