OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/public/common/page_zoom.h" | 45 #include "content/public/common/page_zoom.h" |
46 #include "extensions/browser/extension_registry.h" | 46 #include "extensions/browser/extension_registry.h" |
47 #include "extensions/common/extension_set.h" | 47 #include "extensions/common/extension_set.h" |
48 #include "extensions/common/permissions/api_permission.h" | 48 #include "extensions/common/permissions/api_permission.h" |
49 #include "extensions/common/permissions/permissions_data.h" | 49 #include "extensions/common/permissions/permissions_data.h" |
50 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
51 #include "grit/locale_settings.h" | 51 #include "grit/locale_settings.h" |
52 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
53 | 53 |
54 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
55 #include "chrome/browser/chromeos/login/users/user_manager.h" | 55 #include "components/user_manager/user_manager.h" |
56 #endif | 56 #endif |
57 | 57 |
58 using base::UserMetricsAction; | 58 using base::UserMetricsAction; |
59 using extensions::APIPermission; | 59 using extensions::APIPermission; |
60 | 60 |
61 namespace { | 61 namespace { |
62 | 62 |
63 struct ContentSettingsTypeNameEntry { | 63 struct ContentSettingsTypeNameEntry { |
64 ContentSettingsType type; | 64 ContentSettingsType type; |
65 const char* name; | 65 const char* name; |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 return; | 1309 return; |
1310 } | 1310 } |
1311 | 1311 |
1312 ContentSetting default_setting = ContentSettingFromString(setting); | 1312 ContentSetting default_setting = ContentSettingFromString(setting); |
1313 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); | 1313 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); |
1314 Profile* profile = Profile::FromWebUI(web_ui()); | 1314 Profile* profile = Profile::FromWebUI(web_ui()); |
1315 | 1315 |
1316 #if defined(OS_CHROMEOS) | 1316 #if defined(OS_CHROMEOS) |
1317 // ChromeOS special case : in Guest mode settings are opened in Incognito | 1317 // ChromeOS special case : in Guest mode settings are opened in Incognito |
1318 // mode, so we need original profile to actually modify settings. | 1318 // mode, so we need original profile to actually modify settings. |
1319 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) | 1319 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) |
1320 profile = profile->GetOriginalProfile(); | 1320 profile = profile->GetOriginalProfile(); |
1321 #endif | 1321 #endif |
1322 | 1322 |
1323 | 1323 |
1324 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 1324 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
1325 ApplyWhitelist(content_type, default_setting); | 1325 ApplyWhitelist(content_type, default_setting); |
1326 map->SetDefaultContentSetting(content_type, default_setting); | 1326 map->SetDefaultContentSetting(content_type, default_setting); |
1327 | 1327 |
1328 switch (content_type) { | 1328 switch (content_type) { |
1329 case CONTENT_SETTINGS_TYPE_COOKIES: | 1329 case CONTENT_SETTINGS_TYPE_COOKIES: |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1574 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
1575 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1575 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1576 // Exceptions apply only when the feature is enabled. | 1576 // Exceptions apply only when the feature is enabled. |
1577 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1577 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1578 web_ui()->CallJavascriptFunction( | 1578 web_ui()->CallJavascriptFunction( |
1579 "ContentSettings.enableProtectedContentExceptions", | 1579 "ContentSettings.enableProtectedContentExceptions", |
1580 base::FundamentalValue(enable_exceptions)); | 1580 base::FundamentalValue(enable_exceptions)); |
1581 } | 1581 } |
1582 | 1582 |
1583 } // namespace options | 1583 } // namespace options |
OLD | NEW |