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