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

Side by Side Diff: chrome/common/content_settings.h

Issue 8538004: Take script URLs into account when applying script content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_CONTENT_SETTINGS_H_ 5 #ifndef CHROME_COMMON_CONTENT_SETTINGS_H_
6 #define CHROME_COMMON_CONTENT_SETTINGS_H_ 6 #define CHROME_COMMON_CONTENT_SETTINGS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "chrome/common/content_settings_pattern.h" 12 #include "chrome/common/content_settings_pattern.h"
13 #include "chrome/common/content_settings_types.h" 13 #include "chrome/common/content_settings_types.h"
14 14
15 // Different settings that can be assigned for a particular content type. We 15 // Different settings that can be assigned for a particular content type. We
16 // give the user the ability to set these on a global and per-origin basis. 16 // give the user the ability to set these on a global and per-origin basis.
17 enum ContentSetting { 17 enum ContentSetting {
18 CONTENT_SETTING_DEFAULT = 0, 18 CONTENT_SETTING_DEFAULT = 0,
19 CONTENT_SETTING_ALLOW, 19 CONTENT_SETTING_ALLOW,
20 CONTENT_SETTING_BLOCK, 20 CONTENT_SETTING_BLOCK,
21 CONTENT_SETTING_ASK, 21 CONTENT_SETTING_ASK,
22 CONTENT_SETTING_SESSION_ONLY, 22 CONTENT_SETTING_SESSION_ONLY,
23 CONTENT_SETTING_NUM_SETTINGS 23 CONTENT_SETTING_NUM_SETTINGS
24 }; 24 };
25 25
26 // Range-checked conversion of an int to a ContentSetting, for use when reading 26 // Range-checked conversion of an int to a ContentSetting, for use when reading
27 // prefs off disk. 27 // prefs off disk.
28 ContentSetting IntToContentSetting(int content_setting); 28 ContentSetting IntToContentSetting(int content_setting);
29 29
30 // Aggregates the permissions for the different content types.
31 struct ContentSettings {
32 ContentSettings();
33 explicit ContentSettings(ContentSetting default_setting);
34
35 ContentSetting settings[CONTENT_SETTINGS_NUM_TYPES];
36 };
37
38 struct ContentSettingPatternSource { 30 struct ContentSettingPatternSource {
39 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern, 31 ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern,
40 const ContentSettingsPattern& secondary_patttern, 32 const ContentSettingsPattern& secondary_patttern,
41 ContentSetting setting, 33 ContentSetting setting,
42 const std::string& source, 34 const std::string& source,
43 bool incognito); 35 bool incognito);
44 ContentSettingPatternSource(); 36 ContentSettingPatternSource();
45 ContentSettingsPattern primary_pattern; 37 ContentSettingsPattern primary_pattern;
46 ContentSettingsPattern secondary_pattern; 38 ContentSettingsPattern secondary_pattern;
47 ContentSetting setting; 39 ContentSetting setting;
48 std::string source; 40 std::string source;
49 bool incognito; 41 bool incognito;
50 }; 42 };
51 43
52 typedef std::vector<ContentSettingPatternSource> ContentSettingsForOneType; 44 typedef std::vector<ContentSettingPatternSource> ContentSettingsForOneType;
53 45
46 struct RendererContentSettingRules {
47 RendererContentSettingRules();
48 ~RendererContentSettingRules();
49 ContentSettingsForOneType image_rules;
50 ContentSettingsForOneType script_rules;
51 };
52
54 namespace content_settings { 53 namespace content_settings {
55 54
56 // Enum containing the various source for content settings. Settings can be 55 // Enum containing the various source for content settings. Settings can be
57 // set by policy, extension or the user. Certain (internal) schemes are 56 // set by policy, extension or the user. Certain (internal) schemes are
58 // whilelisted. For whilelisted schemes the source is 57 // whilelisted. For whilelisted schemes the source is
59 // |SETTING_SOURCE_WHITELIST|. 58 // |SETTING_SOURCE_WHITELIST|.
60 enum SettingSource { 59 enum SettingSource {
61 SETTING_SOURCE_NONE, 60 SETTING_SOURCE_NONE,
62 SETTING_SOURCE_POLICY, 61 SETTING_SOURCE_POLICY,
63 SETTING_SOURCE_EXTENSION, 62 SETTING_SOURCE_EXTENSION,
64 SETTING_SOURCE_USER, 63 SETTING_SOURCE_USER,
65 SETTING_SOURCE_WHITELIST, 64 SETTING_SOURCE_WHITELIST,
66 }; 65 };
67 66
68 // |SettingInfo| provides meta data for content setting values. |source| 67 // |SettingInfo| provides meta data for content setting values. |source|
69 // contains the source of a value. |primary_pattern| and |secondary_pattern| 68 // contains the source of a value. |primary_pattern| and |secondary_pattern|
70 // contains the patterns of the appling rule. 69 // contains the patterns of the appling rule.
71 struct SettingInfo { 70 struct SettingInfo {
72 SettingSource source; 71 SettingSource source;
73 ContentSettingsPattern primary_pattern; 72 ContentSettingsPattern primary_pattern;
74 ContentSettingsPattern secondary_pattern; 73 ContentSettingsPattern secondary_pattern;
75 }; 74 };
76 75
77 } // namespace content_settings 76 } // namespace content_settings
78 77
79 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_ 78 #endif // CHROME_COMMON_CONTENT_SETTINGS_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc ('k') | chrome/common/content_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698