Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / content_settings / core / common / content_settings.h
blob7745ac1836293723e15c6882136e236d69e6192a
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_H_
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_H_
8 #include <string>
9 #include <vector>
11 #include "components/content_settings/core/common/content_settings_pattern.h"
12 #include "components/content_settings/core/common/content_settings_types.h"
14 // Different settings that can be assigned for a particular content type. We
15 // give the user the ability to set these on a global and per-origin basis.
16 // A Java counterpart will be generated for this enum.
17 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser
18 enum ContentSetting {
19 CONTENT_SETTING_DEFAULT = 0,
20 CONTENT_SETTING_ALLOW,
21 CONTENT_SETTING_BLOCK,
22 CONTENT_SETTING_ASK,
23 CONTENT_SETTING_SESSION_ONLY,
24 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
25 CONTENT_SETTING_NUM_SETTINGS
28 // Range-checked conversion of an int to a ContentSetting, for use when reading
29 // prefs off disk.
30 ContentSetting IntToContentSetting(int content_setting);
32 // Converts a given content setting to its histogram value, for use when saving
33 // content settings types to a histogram.
34 ContentSettingsTypeHistogram ContentSettingTypeToHistogramValue(
35 ContentSettingsType content_setting);
37 // Whether this content setting should be synced.
38 bool IsContentSettingsTypeSyncable(ContentSettingsType content_setting);
40 struct ContentSettingPatternSource {
41 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern,
42 const ContentSettingsPattern& secondary_patttern,
43 ContentSetting setting,
44 const std::string& source,
45 bool incognito);
46 ContentSettingPatternSource();
47 ContentSettingsPattern primary_pattern;
48 ContentSettingsPattern secondary_pattern;
49 ContentSetting setting;
50 std::string source;
51 bool incognito;
54 typedef std::vector<ContentSettingPatternSource> ContentSettingsForOneType;
56 struct RendererContentSettingRules {
57 RendererContentSettingRules();
58 ~RendererContentSettingRules();
59 ContentSettingsForOneType image_rules;
60 ContentSettingsForOneType script_rules;
63 namespace content_settings {
65 // Enum containing the various source for content settings. Settings can be
66 // set by policy, extension, the user or by the custodian of a supervised user.
67 // Certain (internal) schemes are whilelisted. For whilelisted schemes the
68 // source is |SETTING_SOURCE_WHITELIST|.
69 enum SettingSource {
70 SETTING_SOURCE_NONE,
71 SETTING_SOURCE_POLICY,
72 SETTING_SOURCE_EXTENSION,
73 SETTING_SOURCE_USER,
74 SETTING_SOURCE_WHITELIST,
75 SETTING_SOURCE_SUPERVISED,
78 // |SettingInfo| provides meta data for content setting values. |source|
79 // contains the source of a value. |primary_pattern| and |secondary_pattern|
80 // contains the patterns of the appling rule.
81 struct SettingInfo {
82 SettingSource source;
83 ContentSettingsPattern primary_pattern;
84 ContentSettingsPattern secondary_pattern;
87 } // namespace content_settings
89 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_H_