Chromium Code Reviews| 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, // Not used for Geolocation | 45 NULL, // Not used for Geolocation |
| 46 NULL, // Not used for Notifications | 46 NULL, // Not used for Notifications |
| 47 NULL, // Not used for Auto-Submit-Certificate | |
| 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 | |
|
Mattias Nissler (ping if slow)
2011/08/16 11:21:35
align the comment
markusheintz_
2011/08/16 11:38:27
Done.
| |
| 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 // TODO(markusheintz): Refactoring in progress. Content settings exceptions | 73 // TODO(markusheintz): Refactoring in progress. Content settings exceptions |
| 72 // for notifications and geolocation will be added next. | 74 // for notifications and geolocation will be added next. |
| 73 "geolocation", // Only used for default Geolocation settings | 75 "geolocation", // Only used for default Geolocation settings |
| 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 DCHECK(found); | 1079 DCHECK(found); |
| 1077 std::string new_key = pattern_pair.first.ToString(); | 1080 std::string new_key = pattern_pair.first.ToString(); |
| 1078 // Existing values are overwritten. | 1081 // Existing values are overwritten. |
| 1079 obsolete_settings_dictionary->SetWithoutPathExpansion( | 1082 obsolete_settings_dictionary->SetWithoutPathExpansion( |
| 1080 new_key, dictionary->DeepCopy()); | 1083 new_key, dictionary->DeepCopy()); |
| 1081 } | 1084 } |
| 1082 } | 1085 } |
| 1083 } | 1086 } |
| 1084 | 1087 |
| 1085 } // namespace content_settings | 1088 } // namespace content_settings |
| OLD | NEW |