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

Unified Diff: chrome/browser/extensions/api/content_settings/content_settings_api.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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/content_settings/content_settings_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/content_settings/content_settings_api.cc
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.cc b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
index 0030797ab026950e9cab4f087aa0ec9dcef5816f..4d41984ed54b11e5b088e84f1d6e4c326dfb1c1a 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/content_settings.h"
+#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/plugin_service.h"
@@ -163,8 +164,10 @@ bool ContentSettingsContentSettingGetFunction::RunSync() {
}
base::DictionaryValue* result = new base::DictionaryValue();
- result->SetString(keys::kContentSettingKey,
- helpers::ContentSettingToString(setting));
+ std::string setting_string =
+ content_settings::ContentSettingToString(setting);
+ DCHECK(!setting_string.empty());
+ result->SetString(keys::kContentSettingKey, setting_string);
SetResult(result);
@@ -208,7 +211,7 @@ bool ContentSettingsContentSettingSetFunction::RunSync() {
params->details.setting->GetAsString(&setting_str));
ContentSetting setting;
EXTENSION_FUNCTION_VALIDATE(
- helpers::StringToContentSetting(setting_str, &setting));
+ content_settings::ContentSettingFromString(setting_str, &setting));
EXTENSION_FUNCTION_VALIDATE(HostContentSettingsMap::IsSettingAllowedForType(
GetProfile()->GetPrefs(), setting, content_type));
@@ -240,7 +243,7 @@ bool ContentSettingsContentSettingSetFunction::RunSync() {
error_ = base::StringPrintf(
kUnsupportedDefaultSettingError,
- content_settings_helpers::ContentSettingToString(setting),
+ setting_str.c_str(),
readable_type_name.c_str());
return false;
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/content_settings/content_settings_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698