Index: components/content_settings/core/common/content_settings_utils.h |
diff --git a/components/content_settings/core/common/content_settings_utils.h b/components/content_settings/core/common/content_settings_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4fad0022b4f21d92ae338a70acf62a91fd4b2937 |
--- /dev/null |
+++ b/components/content_settings/core/common/content_settings_utils.h |
@@ -0,0 +1,33 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_UTILS_H_ |
+#define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_UTILS_H_ |
+ |
+#include <memory> |
+ |
+#include "components/content_settings/core/common/content_settings.h" |
+ |
+namespace base { |
+class Value; |
+} |
+ |
+namespace content_settings { |
+ |
+// Converts |Value| to |ContentSetting|. |
+ContentSetting ValueToContentSetting(const base::Value* value); |
+ |
+// Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes |
+// a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| |
+// is encoded as a NULL value, so it is not allowed as an integer value. |
+bool ParseContentSettingValue(const base::Value* value, |
+ ContentSetting* setting); |
+ |
+// Returns a |base::Value*| representation of |setting| if |setting| is |
+// a valid content setting. Otherwise, returns a nullptr. |
+std::unique_ptr<base::Value> ContentSettingToValue(ContentSetting setting); |
+ |
+} // namespace content_settings |
+ |
+#endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_UTILS_H_ |