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 CHROME_COMMON_CONTENT_SETTINGS_H_
6 #define CHROME_COMMON_CONTENT_SETTINGS_H_
11 #include "chrome/common/content_settings_pattern.h"
12 #include "chrome/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.
17 CONTENT_SETTING_DEFAULT
= 0,
18 CONTENT_SETTING_ALLOW
,
19 CONTENT_SETTING_BLOCK
,
21 CONTENT_SETTING_SESSION_ONLY
,
22 CONTENT_SETTING_NUM_SETTINGS
25 // Range-checked conversion of an int to a ContentSetting, for use when reading
27 ContentSetting
IntToContentSetting(int content_setting
);
29 struct ContentSettingPatternSource
{
30 ContentSettingPatternSource(const ContentSettingsPattern
& primary_pattern
,
31 const ContentSettingsPattern
& secondary_patttern
,
32 ContentSetting setting
,
33 const std::string
& source
,
35 ContentSettingPatternSource();
36 ContentSettingsPattern primary_pattern
;
37 ContentSettingsPattern secondary_pattern
;
38 ContentSetting setting
;
43 typedef std::vector
<ContentSettingPatternSource
> ContentSettingsForOneType
;
45 struct RendererContentSettingRules
{
46 RendererContentSettingRules();
47 ~RendererContentSettingRules();
48 ContentSettingsForOneType image_rules
;
49 ContentSettingsForOneType script_rules
;
52 namespace content_settings
{
54 // Enum containing the various source for content settings. Settings can be
55 // set by policy, extension or the user. Certain (internal) schemes are
56 // whilelisted. For whilelisted schemes the source is
57 // |SETTING_SOURCE_WHITELIST|.
60 SETTING_SOURCE_POLICY
,
61 SETTING_SOURCE_EXTENSION
,
63 SETTING_SOURCE_WHITELIST
,
66 // |SettingInfo| provides meta data for content setting values. |source|
67 // contains the source of a value. |primary_pattern| and |secondary_pattern|
68 // contains the patterns of the appling rule.
71 ContentSettingsPattern primary_pattern
;
72 ContentSettingsPattern secondary_pattern
;
75 } // namespace content_settings
77 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_