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

Side by Side Diff: chrome/browser/extensions/api/settings_private/prefs_util.cc

Issue 1168793002: Add an initial implementation of the Privacy Page. No subpages yet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jhawkins's comments Created 5 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" 8 #include "chrome/browser/extensions/api/settings_private/prefs_util.h"
9 #include "chrome/browser/extensions/chrome_extension_function.h" 9 #include "chrome/browser/extensions/chrome_extension_function.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 18 matching lines...) Expand all
29 29
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 using CrosSettings = chromeos::CrosSettings; 31 using CrosSettings = chromeos::CrosSettings;
32 #endif 32 #endif
33 33
34 const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { 34 const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
35 static PrefsUtil::TypedPrefMap* s_whitelist = nullptr; 35 static PrefsUtil::TypedPrefMap* s_whitelist = nullptr;
36 if (s_whitelist) 36 if (s_whitelist)
37 return *s_whitelist; 37 return *s_whitelist;
38 s_whitelist = new PrefsUtil::TypedPrefMap(); 38 s_whitelist = new PrefsUtil::TypedPrefMap();
39 (*s_whitelist)["browser.show_home_button"] = 39 (*s_whitelist)["alternate_error_pages.enabled"] =
40 settings_private::PrefType::PREF_TYPE_BOOLEAN; 40 settings_private::PrefType::PREF_TYPE_BOOLEAN;
41 (*s_whitelist)["bookmark_bar.show_on_all_tabs"] = 41 (*s_whitelist)["bookmark_bar.show_on_all_tabs"] =
42 settings_private::PrefType::PREF_TYPE_BOOLEAN; 42 settings_private::PrefType::PREF_TYPE_BOOLEAN;
43 (*s_whitelist)["browser.show_home_button"] =
44 settings_private::PrefType::PREF_TYPE_BOOLEAN;
43 (*s_whitelist)["download.default_directory"] = 45 (*s_whitelist)["download.default_directory"] =
44 settings_private::PrefType::PREF_TYPE_STRING; 46 settings_private::PrefType::PREF_TYPE_STRING;
45 (*s_whitelist)["download.prompt_for_download"] = 47 (*s_whitelist)["download.prompt_for_download"] =
46 settings_private::PrefType::PREF_TYPE_BOOLEAN; 48 settings_private::PrefType::PREF_TYPE_BOOLEAN;
49 (*s_whitelist)["enable_do_not_track"] =
50 settings_private::PrefType::PREF_TYPE_BOOLEAN;
47 (*s_whitelist)["homepage"] = settings_private::PrefType::PREF_TYPE_URL; 51 (*s_whitelist)["homepage"] = settings_private::PrefType::PREF_TYPE_URL;
52 (*s_whitelist)["net.network_prediction_options"] =
53 settings_private::PrefType::PREF_TYPE_BOOLEAN;
54 (*s_whitelist)["safebrowsing.enabled"] =
55 settings_private::PrefType::PREF_TYPE_BOOLEAN;
56 (*s_whitelist)["safebrowsing.extended_reporting_enabled"] =
57 settings_private::PrefType::PREF_TYPE_BOOLEAN;
58 (*s_whitelist)["search.suggest_enabled"] =
59 settings_private::PrefType::PREF_TYPE_BOOLEAN;
60 (*s_whitelist)["spellcheck.use_spelling_service"] =
61 settings_private::PrefType::PREF_TYPE_BOOLEAN;
48 62
49 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
50 (*s_whitelist)["cros.accounts.allowBWSI"] = 64 (*s_whitelist)["cros.accounts.allowBWSI"] =
51 settings_private::PrefType::PREF_TYPE_BOOLEAN; 65 settings_private::PrefType::PREF_TYPE_BOOLEAN;
52 (*s_whitelist)["cros.accounts.supervisedUsersEnabled"] = 66 (*s_whitelist)["cros.accounts.supervisedUsersEnabled"] =
53 settings_private::PrefType::PREF_TYPE_BOOLEAN; 67 settings_private::PrefType::PREF_TYPE_BOOLEAN;
54 (*s_whitelist)["cros.accounts.showUserNamesOnSignIn"] = 68 (*s_whitelist)["cros.accounts.showUserNamesOnSignIn"] =
55 settings_private::PrefType::PREF_TYPE_BOOLEAN; 69 settings_private::PrefType::PREF_TYPE_BOOLEAN;
56 (*s_whitelist)["cros.accounts.allowGuest"] = 70 (*s_whitelist)["cros.accounts.allowGuest"] =
57 settings_private::PrefType::PREF_TYPE_BOOLEAN; 71 settings_private::PrefType::PREF_TYPE_BOOLEAN;
(...skipping 12 matching lines...) Expand all
70 (*s_whitelist)["settings.a11y.screen_magnifier"] = 84 (*s_whitelist)["settings.a11y.screen_magnifier"] =
71 settings_private::PrefType::PREF_TYPE_BOOLEAN; 85 settings_private::PrefType::PREF_TYPE_BOOLEAN;
72 (*s_whitelist)["settings.a11y.sticky_keys_enabled"] = 86 (*s_whitelist)["settings.a11y.sticky_keys_enabled"] =
73 settings_private::PrefType::PREF_TYPE_BOOLEAN; 87 settings_private::PrefType::PREF_TYPE_BOOLEAN;
74 (*s_whitelist)["settings.a11y.virtual_keyboard"] = 88 (*s_whitelist)["settings.a11y.virtual_keyboard"] =
75 settings_private::PrefType::PREF_TYPE_BOOLEAN; 89 settings_private::PrefType::PREF_TYPE_BOOLEAN;
76 (*s_whitelist)["settings.clock.use_24hour_clock"] = 90 (*s_whitelist)["settings.clock.use_24hour_clock"] =
77 settings_private::PrefType::PREF_TYPE_BOOLEAN; 91 settings_private::PrefType::PREF_TYPE_BOOLEAN;
78 (*s_whitelist)["settings.touchpad.enable_tap_dragging"] = 92 (*s_whitelist)["settings.touchpad.enable_tap_dragging"] =
79 settings_private::PrefType::PREF_TYPE_BOOLEAN; 93 settings_private::PrefType::PREF_TYPE_BOOLEAN;
94 (*s_whitelist)["cros.metrics.reportingEnabled"] =
95 settings_private::PrefType::PREF_TYPE_BOOLEAN;
96 (*s_whitelist)["cros.device.attestation_for_content_protection_enabled"] =
97 settings_private::PrefType::PREF_TYPE_BOOLEAN;
98 (*s_whitelist)["settings.internet.wake_on_wifi_ssid"] =
99 settings_private::PrefType::PREF_TYPE_BOOLEAN;
80 #endif 100 #endif
81 101
82 return *s_whitelist; 102 return *s_whitelist;
83 } 103 }
84 104
85 api::settings_private::PrefType PrefsUtil::GetType(const std::string& name, 105 api::settings_private::PrefType PrefsUtil::GetType(const std::string& name,
86 base::Value::Type type) { 106 base::Value::Type type) {
87 switch (type) { 107 switch (type) {
88 case base::Value::Type::TYPE_BOOLEAN: 108 case base::Value::Type::TYPE_BOOLEAN:
89 return api::settings_private::PrefType::PREF_TYPE_BOOLEAN; 109 return api::settings_private::PrefType::PREF_TYPE_BOOLEAN;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 346
327 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) { 347 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) {
328 #if defined(OS_CHROMEOS) 348 #if defined(OS_CHROMEOS)
329 return CrosSettings::Get()->IsCrosSettings(pref_name); 349 return CrosSettings::Get()->IsCrosSettings(pref_name);
330 #else 350 #else
331 return false; 351 return false;
332 #endif 352 #endif
333 } 353 }
334 354
335 } // namespace extensions 355 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698