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 27 matching lines...) Expand all Loading... |
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, // Not used for Intents. | 47 NULL, // Not used for Intents. |
| 48 NULL, |
48 }; | 49 }; |
49 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 50 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
50 resource_type_names_incorrect_size); | 51 resource_type_names_incorrect_size); |
51 | 52 |
52 // The default setting for each content type. | 53 // The default setting for each content type. |
53 const ContentSetting kDefaultSettings[] = { | 54 const ContentSetting kDefaultSettings[] = { |
54 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES | 55 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES |
55 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES | 56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES |
56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 57 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
57 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS | 58 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
58 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS | 59 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
59 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION | 60 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION |
60 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS | 61 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
61 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_INTENTS | 62 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_INTENTS |
| 63 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
62 }; | 64 }; |
63 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, | 65 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, |
64 default_settings_incorrect_size); | 66 default_settings_incorrect_size); |
65 | 67 |
66 // The names of the ContentSettingsType values, for use with dictionary prefs. | 68 // The names of the ContentSettingsType values, for use with dictionary prefs. |
67 const char* kTypeNames[] = { | 69 const char* kTypeNames[] = { |
68 "cookies", | 70 "cookies", |
69 "images", | 71 "images", |
70 "javascript", | 72 "javascript", |
71 "plugins", | 73 "plugins", |
72 "popups", | 74 "popups", |
73 "geolocation", | 75 "geolocation", |
74 // TODO(markusheintz): Refactoring in progress. Content settings exceptions | 76 // TODO(markusheintz): Refactoring in progress. Content settings exceptions |
75 // for notifications added next. | 77 // for notifications added next. |
76 "notifications", // Only used for default Notifications settings. | 78 "notifications", // Only used for default Notifications settings. |
77 "intents", | 79 "intents", |
| 80 "auto-select-certificate" |
78 }; | 81 }; |
79 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 82 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
80 type_names_incorrect_size); | 83 type_names_incorrect_size); |
81 | 84 |
82 void SetDefaultContentSettings(DictionaryValue* default_settings) { | 85 void SetDefaultContentSettings(DictionaryValue* default_settings) { |
83 default_settings->Clear(); | 86 default_settings->Clear(); |
84 | 87 |
85 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 88 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
86 if (kTypeNames[i] != NULL) { | 89 if (kTypeNames[i] != NULL) { |
87 default_settings->SetInteger(kTypeNames[i], | 90 default_settings->SetInteger(kTypeNames[i], |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); | 1231 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value); |
1229 | 1232 |
1230 UpdateObsoleteGeolocationPref(pattern_pair.first, | 1233 UpdateObsoleteGeolocationPref(pattern_pair.first, |
1231 pattern_pair.second, | 1234 pattern_pair.second, |
1232 ContentSetting(setting_value)); | 1235 ContentSetting(setting_value)); |
1233 } | 1236 } |
1234 } | 1237 } |
1235 } | 1238 } |
1236 | 1239 |
1237 } // namespace content_settings | 1240 } // namespace content_settings |
OLD | NEW |