Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 1252073002: Move pref names and default value into WebsiteSettingsInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-simple
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 27 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
31 #include "chrome/grit/locale_settings.h" 31 #include "chrome/grit/locale_settings.h"
32 #include "components/content_settings/core/browser/content_settings_details.h" 32 #include "components/content_settings/core/browser/content_settings_details.h"
33 #include "components/content_settings/core/browser/content_settings_utils.h" 33 #include "components/content_settings/core/browser/content_settings_utils.h"
34 #include "components/content_settings/core/browser/host_content_settings_map.h" 34 #include "components/content_settings/core/browser/host_content_settings_map.h"
35 #include "components/content_settings/core/browser/plugins_field_trial.h" 35 #include "components/content_settings/core/browser/plugins_field_trial.h"
36 #include "components/content_settings/core/browser/website_settings_info.h"
37 #include "components/content_settings/core/browser/website_settings_registry.h"
36 #include "components/content_settings/core/common/content_settings.h" 38 #include "components/content_settings/core/common/content_settings.h"
37 #include "components/content_settings/core/common/content_settings_pattern.h" 39 #include "components/content_settings/core/common/content_settings_pattern.h"
38 #include "components/google/core/browser/google_util.h" 40 #include "components/google/core/browser/google_util.h"
39 #include "components/signin/core/common/profile_management_switches.h" 41 #include "components/signin/core/common/profile_management_switches.h"
40 #include "components/user_prefs/user_prefs.h" 42 #include "components/user_prefs/user_prefs.h"
41 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
42 #include "content/public/browser/notification_source.h" 44 #include "content/public/browser/notification_source.h"
43 #include "content/public/browser/notification_types.h" 45 #include "content/public/browser/notification_types.h"
44 #include "content/public/browser/storage_partition.h" 46 #include "content/public/browser/storage_partition.h"
45 #include "content/public/browser/user_metrics.h" 47 #include "content/public/browser/user_metrics.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO}, 403 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO},
402 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO}, 404 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO},
403 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO}, 405 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO},
404 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL}, 406 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL},
405 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, 407 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON},
406 }; 408 };
407 409
408 RegisterStrings(localized_strings, resources, arraysize(resources)); 410 RegisterStrings(localized_strings, resources, arraysize(resources));
409 411
410 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 412 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
411 const base::Value* default_pref = 413 const base::Value* default_pref = prefs->GetDefaultPrefValue(
412 prefs->GetDefaultPrefValue(prefs::kDefaultPluginsSetting); 414 content_settings::WebsiteSettingsRegistry::GetInstance()
415 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS)
416 ->default_value_pref_name());
413 417
414 int default_value = CONTENT_SETTING_DEFAULT; 418 int default_value = CONTENT_SETTING_DEFAULT;
415 bool success = default_pref->GetAsInteger(&default_value); 419 bool success = default_pref->GetAsInteger(&default_value);
416 DCHECK(success); 420 DCHECK(success);
417 DCHECK_NE(default_value, CONTENT_SETTING_DEFAULT); 421 DCHECK_NE(default_value, CONTENT_SETTING_DEFAULT);
418 422
419 int plugin_ids = default_value == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ? 423 int plugin_ids = default_value == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ?
420 IDS_PLUGIN_DETECT_RECOMMENDED_RADIO : IDS_PLUGIN_DETECT_RADIO; 424 IDS_PLUGIN_DETECT_RECOMMENDED_RADIO : IDS_PLUGIN_DETECT_RADIO;
421 localized_strings->SetString("pluginsDetect", 425 localized_strings->SetString("pluginsDetect",
422 l10n_util::GetStringUTF16(plugin_ids)); 426 l10n_util::GetStringUTF16(plugin_ids));
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 1645
1642 // Exceptions apply only when the feature is enabled. 1646 // Exceptions apply only when the feature is enabled.
1643 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1647 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1644 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1648 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1645 web_ui()->CallJavascriptFunction( 1649 web_ui()->CallJavascriptFunction(
1646 "ContentSettings.enableProtectedContentExceptions", 1650 "ContentSettings.enableProtectedContentExceptions",
1647 base::FundamentalValue(enable_exceptions)); 1651 base::FundamentalValue(enable_exceptions));
1648 } 1652 }
1649 1653
1650 } // namespace options 1654 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698