Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Unified Diff: chrome/browser/extensions/api/content_settings/content_settings_helpers.cc

Issue 1372353004: Making structure for ContentSettings and its corresponding strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
index 9606a4d2fbc9130bcffe36b5373c3d9cb92ebdf9..362c3d9724c3c529d62c97a5d1a514ea3dc8eb37 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
@@ -19,18 +19,6 @@ const char kNoPathWildcardsError[] =
const char kNoPathsError[] = "Specific paths are not allowed.";
const char kInvalidPatternError[] = "The pattern \"*\" is invalid.";
-const char* const kContentSettingNames[] = {
- "default",
- "allow",
- "block",
- "ask",
- "session_only",
- "detect_important_content"
-};
-static_assert(arraysize(kContentSettingNames) <=
- CONTENT_SETTING_NUM_SETTINGS,
- "kContentSettingNames has an unexpected number of elements");
-
// TODO(bauerb): Move this someplace where it can be reused.
std::string GetDefaultPort(const std::string& scheme) {
if (scheme == url::kHttpScheme)
@@ -120,22 +108,5 @@ std::string ContentSettingsTypeToString(ContentSettingsType type) {
->name();
}
-bool StringToContentSetting(const std::string& setting_str,
- ContentSetting* setting) {
- for (size_t type = 0; type < arraysize(kContentSettingNames); ++type) {
- if (setting_str == kContentSettingNames[type]) {
- *setting = static_cast<ContentSetting>(type);
- return true;
- }
- }
- return false;
-}
-
-const char* ContentSettingToString(ContentSetting setting) {
- size_t index = static_cast<size_t>(setting);
- DCHECK_LT(index, arraysize(kContentSettingNames));
- return kContentSettingNames[index];
-}
-
} // namespace content_settings_helpers
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698