OLD | NEW |
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 #include "chrome/browser/content_settings/content_settings_utils.h" | 5 #include "chrome/browser/content_settings/content_settings_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // True if a given content settings type requires additional resource | 17 // True if a given content settings type requires additional resource |
18 // identifiers. | 18 // identifiers. |
19 const bool kSupportsResourceIdentifier[CONTENT_SETTINGS_NUM_TYPES] = { | 19 const bool kSupportsResourceIdentifier[CONTENT_SETTINGS_NUM_TYPES] = { |
20 false, // CONTENT_SETTINGS_TYPE_COOKIES | 20 false, // CONTENT_SETTINGS_TYPE_COOKIES |
21 false, // CONTENT_SETTINGS_TYPE_IMAGES | 21 false, // CONTENT_SETTINGS_TYPE_IMAGES |
22 false, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 22 false, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
23 true, // CONTENT_SETTINGS_TYPE_PLUGINS | 23 true, // CONTENT_SETTINGS_TYPE_PLUGINS |
24 false, // CONTENT_SETTINGS_TYPE_POPUPS | 24 false, // CONTENT_SETTINGS_TYPE_POPUPS |
25 false, // CONTENT_SETTINGS_TYPE_GEOLOCATION | 25 false, // CONTENT_SETTINGS_TYPE_GEOLOCATION |
26 false, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS | 26 false, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
27 false, // CONTENT_SETTINGS_TYPE_INTENTS | 27 false, // CONTENT_SETTINGS_TYPE_INTENTS |
28 false, // CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE | 28 false, // CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE |
| 29 false, // CONTENT_SETTINGS_TYPE_FULLSCREEN |
29 }; | 30 }; |
30 COMPILE_ASSERT(arraysize(kSupportsResourceIdentifier) == | 31 COMPILE_ASSERT(arraysize(kSupportsResourceIdentifier) == |
31 CONTENT_SETTINGS_NUM_TYPES, | 32 CONTENT_SETTINGS_NUM_TYPES, |
32 resource_type_names_incorrect_size); | 33 resource_type_names_incorrect_size); |
33 | 34 |
34 // The preference keys where resource identifiers are stored for | 35 // The preference keys where resource identifiers are stored for |
35 // ContentSettingsType values that support resource identifiers. | 36 // ContentSettingsType values that support resource identifiers. |
36 const char* kResourceTypeNames[] = { | 37 const char* kResourceTypeNames[] = { |
37 NULL, | 38 NULL, |
38 NULL, | 39 NULL, |
39 NULL, | 40 NULL, |
40 "per_plugin", | 41 "per_plugin", |
41 NULL, | 42 NULL, |
42 NULL, | 43 NULL, |
43 NULL, | 44 NULL, |
44 NULL, | 45 NULL, |
45 NULL, | 46 NULL, |
| 47 NULL, |
46 }; | 48 }; |
47 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 49 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
48 resource_type_names_incorrect_size); | 50 resource_type_names_incorrect_size); |
49 | 51 |
50 // The names of the ContentSettingsType values, for use with dictionary prefs. | 52 // The names of the ContentSettingsType values, for use with dictionary prefs. |
51 const char* kTypeNames[] = { | 53 const char* kTypeNames[] = { |
52 "cookies", | 54 "cookies", |
53 "images", | 55 "images", |
54 "javascript", | 56 "javascript", |
55 "plugins", | 57 "plugins", |
56 "popups", | 58 "popups", |
57 "geolocation", | 59 "geolocation", |
58 "notifications", | 60 "notifications", |
59 "intents", | 61 "intents", |
60 "auto-select-certificate" | 62 "auto-select-certificate", |
| 63 "fullscreen" |
61 }; | 64 }; |
62 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 65 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
63 type_names_incorrect_size); | 66 type_names_incorrect_size); |
64 | 67 |
65 const char* kPatternSeparator = ","; | 68 const char* kPatternSeparator = ","; |
66 | 69 |
67 } // namespace | 70 } // namespace |
68 | 71 |
69 namespace content_settings { | 72 namespace content_settings { |
70 | 73 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return true; | 167 return true; |
165 } | 168 } |
166 int int_value = -1; | 169 int int_value = -1; |
167 if (!value->GetAsInteger(&int_value)) | 170 if (!value->GetAsInteger(&int_value)) |
168 return false; | 171 return false; |
169 *setting = IntToContentSetting(int_value); | 172 *setting = IntToContentSetting(int_value); |
170 return *setting != CONTENT_SETTING_DEFAULT; | 173 return *setting != CONTENT_SETTING_DEFAULT; |
171 } | 174 } |
172 | 175 |
173 } // namespace content_settings | 176 } // namespace content_settings |
OLD | NEW |