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_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 26 matching lines...) Expand all Loading... |
37 // The preference keys where resource identifiers are stored for | 37 // The preference keys where resource identifiers are stored for |
38 // ContentSettingsType values that support resource identifiers. | 38 // ContentSettingsType values that support resource identifiers. |
39 const char* kResourceTypeNames[] = { | 39 const char* kResourceTypeNames[] = { |
40 NULL, | 40 NULL, |
41 NULL, | 41 NULL, |
42 NULL, | 42 NULL, |
43 "per_plugin", | 43 "per_plugin", |
44 NULL, | 44 NULL, |
45 NULL, | 45 NULL, |
46 NULL, // Not used for Notifications | 46 NULL, // Not used for Notifications |
| 47 NULL, |
47 }; | 48 }; |
48 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 49 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
49 resource_type_names_incorrect_size); | 50 resource_type_names_incorrect_size); |
50 | 51 |
51 // The default setting for each content type. | 52 // The default setting for each content type. |
52 const ContentSetting kDefaultSettings[] = { | 53 const ContentSetting kDefaultSettings[] = { |
53 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES | 54 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES |
54 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES | 55 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES |
55 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS | 57 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
57 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS | 58 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
58 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION | 59 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION |
59 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS | 60 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
| 61 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE |
60 }; | 62 }; |
61 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, | 63 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, |
62 default_settings_incorrect_size); | 64 default_settings_incorrect_size); |
63 | 65 |
64 // The names of the ContentSettingsType values, for use with dictionary prefs. | 66 // The names of the ContentSettingsType values, for use with dictionary prefs. |
65 const char* kTypeNames[] = { | 67 const char* kTypeNames[] = { |
66 "cookies", | 68 "cookies", |
67 "images", | 69 "images", |
68 "javascript", | 70 "javascript", |
69 "plugins", | 71 "plugins", |
70 "popups", | 72 "popups", |
71 "geolocation", | 73 "geolocation", |
72 // TODO(markusheintz): Refactoring in progress. Content settings exceptions | 74 // TODO(markusheintz): Refactoring in progress. Content settings exceptions |
73 // for notifications added next. | 75 // for notifications added next. |
74 "notifications", // Only used for default Notifications settings. | 76 "notifications", // Only used for default Notifications settings. |
| 77 "auto-submit-certificate", |
75 }; | 78 }; |
76 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 79 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
77 type_names_incorrect_size); | 80 type_names_incorrect_size); |
78 | 81 |
79 void SetDefaultContentSettings(DictionaryValue* default_settings) { | 82 void SetDefaultContentSettings(DictionaryValue* default_settings) { |
80 default_settings->Clear(); | 83 default_settings->Clear(); |
81 | 84 |
82 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 85 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
83 if (kTypeNames[i] != NULL) { | 86 if (kTypeNames[i] != NULL) { |
84 default_settings->SetInteger(kTypeNames[i], | 87 default_settings->SetInteger(kTypeNames[i], |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); | 1228 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); |
1226 | 1229 |
1227 UpdateObsoleteGeolocationPref(pattern_pair.first, | 1230 UpdateObsoleteGeolocationPref(pattern_pair.first, |
1228 pattern_pair.second, | 1231 pattern_pair.second, |
1229 ContentSetting(setting_value)); | 1232 ContentSetting(setting_value)); |
1230 } | 1233 } |
1231 } | 1234 } |
1232 } | 1235 } |
1233 | 1236 |
1234 } // namespace content_settings | 1237 } // namespace content_settings |
OLD | NEW |