| 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 28 matching lines...) Expand all Loading... |
| 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, | 46 NULL, |
| 47 NULL, | 47 NULL, |
| 48 NULL, | 48 NULL, |
| 49 NULL, |
| 49 }; | 50 }; |
| 50 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 51 COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
| 51 resource_type_names_incorrect_size); | 52 resource_type_names_incorrect_size); |
| 52 | 53 |
| 53 // The default setting for each content type. | 54 // The default setting for each content type. |
| 54 const ContentSetting kDefaultSettings[] = { | 55 const ContentSetting kDefaultSettings[] = { |
| 55 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES | 56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES |
| 56 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES | 57 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES |
| 57 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 58 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
| 58 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS | 59 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
| 59 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS | 60 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
| 60 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION | 61 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION |
| 61 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS | 62 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
| 62 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_INTENTS | 63 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_INTENTS |
| 63 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 64 CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
| 65 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES_SESSION_ONLY |
| 64 }; | 66 }; |
| 65 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, | 67 COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, |
| 66 default_settings_incorrect_size); | 68 default_settings_incorrect_size); |
| 67 | 69 |
| 68 // The names of the ContentSettingsType values, for use with dictionary prefs. | 70 // The names of the ContentSettingsType values, for use with dictionary prefs. |
| 69 const char* kTypeNames[] = { | 71 const char* kTypeNames[] = { |
| 70 "cookies", | 72 "cookies", |
| 71 "images", | 73 "images", |
| 72 "javascript", | 74 "javascript", |
| 73 "plugins", | 75 "plugins", |
| 74 "popups", | 76 "popups", |
| 75 "geolocation", | 77 "geolocation", |
| 76 "notifications", | 78 "notifications", |
| 77 "intents", | 79 "intents", |
| 78 "auto-select-certificate" | 80 "auto-select-certificate", |
| 81 "cookies-session-only", |
| 79 }; | 82 }; |
| 80 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, | 83 COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
| 81 type_names_incorrect_size); | 84 type_names_incorrect_size); |
| 82 | 85 |
| 83 void SetDefaultContentSettings(DictionaryValue* default_settings) { | 86 void SetDefaultContentSettings(DictionaryValue* default_settings) { |
| 84 default_settings->Clear(); | 87 default_settings->Clear(); |
| 85 | 88 |
| 86 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 89 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 87 if (kTypeNames[i] != NULL) { | 90 if (kTypeNames[i] != NULL) { |
| 88 default_settings->SetInteger(kTypeNames[i], | 91 default_settings->SetInteger(kTypeNames[i], |
| (...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 if (settings_dictionary->GetInteger( | 1377 if (settings_dictionary->GetInteger( |
| 1375 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value)) { | 1378 kTypeNames[CONTENT_SETTINGS_TYPE_GEOLOCATION], &setting_value)) { |
| 1376 UpdateObsoleteGeolocationPref(pattern_pair.first, | 1379 UpdateObsoleteGeolocationPref(pattern_pair.first, |
| 1377 pattern_pair.second, | 1380 pattern_pair.second, |
| 1378 ContentSetting(setting_value)); | 1381 ContentSetting(setting_value)); |
| 1379 } | 1382 } |
| 1380 } | 1383 } |
| 1381 } | 1384 } |
| 1382 | 1385 |
| 1383 } // namespace content_settings | 1386 } // namespace content_settings |
| OLD | NEW |