Chromium Code Reviews| Index: chrome/browser/content_settings/content_settings_utils.cc |
| diff --git a/chrome/browser/content_settings/content_settings_utils.cc b/chrome/browser/content_settings/content_settings_utils.cc |
| index 27977f26bbff7f20a7a129f947970a54fb083dab..0fd27413406385cd571927fa550c78e62173292c 100644 |
| --- a/chrome/browser/content_settings/content_settings_utils.cc |
| +++ b/chrome/browser/content_settings/content_settings_utils.cc |
| @@ -64,6 +64,15 @@ std::string GetTypeName(ContentSettingsType type) { |
| return std::string(kTypeNames[type]); |
| } |
| +ContentSettingsType GetTypeFromName(const std::string& name) { |
| + for (size_t type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| + if (name == std::string(GetTypeName(ContentSettingsType(type)))) { |
|
Bernhard Bauer
2014/07/10 08:47:42
If you want to micro-optimize this a bit, use `nam
Daniel Nishi
2014/07/10 19:00:07
Done.
|
| + return ContentSettingsType(type); |
| + } |
| + } |
| + return CONTENT_SETTINGS_TYPE_DEFAULT; |
|
Bernhard Bauer
2014/07/10 08:47:42
It might be a bit better to return a success value
Daniel Nishi
2014/07/10 19:00:07
Good point. I was thinking about maybe placing a N
|
| +} |
| + |
| std::string CreatePatternString( |
| const ContentSettingsPattern& item_pattern, |
| const ContentSettingsPattern& top_level_frame_pattern) { |