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 <list> | 7 #include <list> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 // The preference keys where resource identifiers are stored for | 33 // The preference keys where resource identifiers are stored for |
| 34 // ContentSettingsType values that support resource identifiers. | 34 // ContentSettingsType values that support resource identifiers. |
| 35 const char* kResourceTypeNames[] = { | 35 const char* kResourceTypeNames[] = { |
| 36 NULL, | 36 NULL, |
| 37 NULL, | 37 NULL, |
| 38 NULL, | 38 NULL, |
| 39 "per_plugin", | 39 "per_plugin", |
| 40 NULL, | 40 NULL, |
| 41 NULL, // Not used for Geolocation | 41 NULL, // Not used for Geolocation |
| 42 NULL, // Not used for Notifications | 42 NULL, // Not used for Notifications |
| 43 NULL, // Not used for Auto-Submit-Certificate | |
| 43 }; | 44 }; |
| 44 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 45 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
| 45 resource_type_names_incorrect_size); | 46 resource_type_names_incorrect_size); |
| 46 | 47 |
| 47 // The default setting for each content type. | 48 // The default setting for each content type. |
| 48 const ContentSetting kDefaultSettings[] = { | 49 const ContentSetting kDefaultSettings[] = { |
| 49 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES | 50 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES |
| 50 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES | 51 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES |
| 51 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 52 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
| 52 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS | 53 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
| 53 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS | 54 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
| 54 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION | 55 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION |
| 55 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS | 56 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
| 57 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_AUTO_SUBMIT_CERTIFICATE | |
|
Mattias Nissler (ping if slow)
2011/08/09 15:37:25
Shouldn't it be ASK?
markusheintz_
2011/08/15 19:09:04
Yes. I agree that this would be better.
| |
| 56 }; | 58 }; |
| 57 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, | 59 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, |
| 58 default_settings_incorrect_size); | 60 default_settings_incorrect_size); |
| 59 | 61 |
| 60 // The names of the ContentSettingsType values, for use with dictionary prefs. | 62 // The names of the ContentSettingsType values, for use with dictionary prefs. |
| 61 const char* kTypeNames[] = { | 63 const char* kTypeNames[] = { |
| 62 "cookies", | 64 "cookies", |
| 63 "images", | 65 "images", |
| 64 "javascript", | 66 "javascript", |
| 65 "plugins", | 67 "plugins", |
| 66 "popups", | 68 "popups", |
| 67 // TODO(markusheintz): Refactoring in progress. Content settings exceptions | 69 // TODO(markusheintz): Refactoring in progress. Content settings exceptions |
| 68 // for notifications and geolocation will be added next. | 70 // for notifications and geolocation will be added next. |
| 69 "geolocation", // Only used for default Geolocation settings | 71 "geolocation", // Only used for default Geolocation settings |
| 70 "notifications", // Only used for default Notifications settings. | 72 "notifications", // Only used for default Notifications settings. |
| 73 "auto-submit-certificate" | |
|
wtc
2011/08/11 18:33:55
Nit: Add a comma (,) at the end of the line.
markusheintz_
2011/08/15 19:09:04
Done.
| |
| 71 }; | 74 }; |
| 72 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 75 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
| 73 type_names_incorrect_size); | 76 type_names_incorrect_size); |
| 74 | 77 |
| 75 void SetDefaultContentSettings(DictionaryValue* default_settings) { | 78 void SetDefaultContentSettings(DictionaryValue* default_settings) { |
| 76 default_settings->Clear(); | 79 default_settings->Clear(); |
| 77 | 80 |
| 78 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 81 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 79 if (kTypeNames[i] != NULL) { | 82 if (kTypeNames[i] != NULL) { |
| 80 default_settings->SetInteger(kTypeNames[i], | 83 default_settings->SetInteger(kTypeNames[i], |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 DCHECK(found); | 1037 DCHECK(found); |
| 1035 std::string new_key = pattern_pair.first.ToString(); | 1038 std::string new_key = pattern_pair.first.ToString(); |
| 1036 // Existing values are overwritten. | 1039 // Existing values are overwritten. |
| 1037 obsolete_settings_dictionary->SetWithoutPathExpansion( | 1040 obsolete_settings_dictionary->SetWithoutPathExpansion( |
| 1038 new_key, dictionary->DeepCopy()); | 1041 new_key, dictionary->DeepCopy()); |
| 1039 } | 1042 } |
| 1040 } | 1043 } |
| 1041 } | 1044 } |
| 1042 | 1045 |
| 1043 } // namespace content_settings | 1046 } // namespace content_settings |
| OLD | NEW |