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

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/chromeos/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 14 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "chrome/browser/chromeos/cros/power_library.h" 15 #include "chrome/browser/chromeos/cros/power_library.h"
16 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 16 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
17 #include "chrome/browser/chromeos/input_method/input_method_util.h" 17 #include "chrome/browser/chromeos/input_method/input_method_util.h"
18 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 18 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
19 #include "chrome/browser/chromeos/login/login_utils.h" 19 #include "chrome/browser/chromeos/login/login_utils.h"
20 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
21 #include "chrome/browser/chromeos/system/touchpad_settings.h" 20 #include "chrome/browser/chromeos/system/touchpad_settings.h"
22 #include "chrome/browser/prefs/pref_member.h" 21 #include "chrome/browser/prefs/pref_member.h"
23 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" 23 #include "chrome/browser/prefs/scoped_user_pref_update.h"
25 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
28 #include "content/public/browser/notification_details.h" 27 #include "content/public/browser/notification_details.h"
29 #include "content/public/browser/notification_source.h" 28 #include "content/public/browser/notification_source.h"
29 #include "googleurl/src/gurl.h"
30 #include "unicode/timezone.h" 30 #include "unicode/timezone.h"
31 31
32 namespace chromeos { 32 namespace chromeos {
33 33
34 static const char kFallbackInputMethodLocale[] = "en-US"; 34 static const char kFallbackInputMethodLocale[] = "en-US";
35 35
36 Preferences::Preferences() {} 36 Preferences::Preferences() {}
37 37
38 Preferences::~Preferences() {} 38 Preferences::~Preferences() {}
39 39
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Mobile plan notifications default to on. 188 // Mobile plan notifications default to on.
189 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, 189 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications,
190 true, 190 true,
191 PrefService::SYNCABLE_PREF); 191 PrefService::SYNCABLE_PREF);
192 192
193 // 3G first-time usage promo will be shown at least once. 193 // 3G first-time usage promo will be shown at least once.
194 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, 194 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification,
195 true, 195 true,
196 PrefService::UNSYNCABLE_PREF); 196 PrefService::UNSYNCABLE_PREF);
197 197
198 // Use shared proxies default to off.
199 prefs->RegisterBooleanPref(prefs::kUseSharedProxies,
200 false,
201 PrefService::SYNCABLE_PREF);
202
203 // OAuth1 all access token and secret pair. 198 // OAuth1 all access token and secret pair.
204 prefs->RegisterStringPref(prefs::kOAuth1Token, 199 prefs->RegisterStringPref(prefs::kOAuth1Token,
205 "", 200 "",
206 PrefService::UNSYNCABLE_PREF); 201 PrefService::UNSYNCABLE_PREF);
207 prefs->RegisterStringPref(prefs::kOAuth1Secret, 202 prefs->RegisterStringPref(prefs::kOAuth1Secret,
208 "", 203 "",
209 PrefService::UNSYNCABLE_PREF); 204 PrefService::UNSYNCABLE_PREF);
210 } 205 }
211 206
212 void Preferences::Init(PrefService* prefs) { 207 void Preferences::Init(PrefService* prefs) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); 263 prefs::kLanguageXkbRemapAltKeyTo, prefs, this);
269 language_xkb_auto_repeat_enabled_.Init( 264 language_xkb_auto_repeat_enabled_.Init(
270 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); 265 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
271 language_xkb_auto_repeat_delay_pref_.Init( 266 language_xkb_auto_repeat_delay_pref_.Init(
272 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); 267 prefs::kLanguageXkbAutoRepeatDelay, prefs, this);
273 language_xkb_auto_repeat_interval_pref_.Init( 268 language_xkb_auto_repeat_interval_pref_.Init(
274 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); 269 prefs::kLanguageXkbAutoRepeatInterval, prefs, this);
275 270
276 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); 271 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this);
277 272
278 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this);
279
280 // Initialize preferences to currently saved state. 273 // Initialize preferences to currently saved state.
281 NotifyPrefChanged(NULL); 274 NotifyPrefChanged(NULL);
282 275
283 // Initialize virtual keyboard settings to currently saved state. 276 // Initialize virtual keyboard settings to currently saved state.
284 UpdateVirturalKeyboardPreference(prefs); 277 UpdateVirturalKeyboardPreference(prefs);
285 278
286 // If a guest is logged in, initialize the prefs as if this is the first 279 // If a guest is logged in, initialize the prefs as if this is the first
287 // login. 280 // login.
288 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { 281 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
289 LoginUtils::Get()->SetFirstLoginPrefs(prefs); 282 LoginUtils::Get()->SetFirstLoginPrefs(prefs);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, 452 language_prefs::kMozcIntegerPrefs[i].ibus_config_name,
460 language_mozc_integer_prefs_[i].GetValue()); 453 language_mozc_integer_prefs_[i].GetValue());
461 } 454 }
462 } 455 }
463 456
464 // Init or update power manager config. 457 // Init or update power manager config.
465 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { 458 if (!pref_name || *pref_name == prefs::kEnableScreenLock) {
466 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock( 459 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock(
467 enable_screen_lock_.GetValue()); 460 enable_screen_lock_.GetValue());
468 } 461 }
469
470 if (!pref_name || *pref_name == prefs::kUseSharedProxies) {
471 g_browser_process->chromeos_proxy_config_service_impl()->
472 UISetUseSharedProxies(use_shared_proxies_.GetValue());
473 }
474 } 462 }
475 463
476 void Preferences::SetLanguageConfigBoolean(const char* section, 464 void Preferences::SetLanguageConfigBoolean(const char* section,
477 const char* name, 465 const char* name,
478 bool value) { 466 bool value) {
479 input_method::ImeConfigValue config; 467 input_method::ImeConfigValue config;
480 config.type = input_method::ImeConfigValue::kValueTypeBool; 468 config.type = input_method::ImeConfigValue::kValueTypeBool;
481 config.bool_value = value; 469 config.bool_value = value;
482 input_method::InputMethodManager::GetInstance()-> 470 input_method::InputMethodManager::GetInstance()->
483 SetImeConfig(section, name, config); 471 SetImeConfig(section, name, config);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 586
599 // Remove invalid prefs. 587 // Remove invalid prefs.
600 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); 588 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard);
601 DictionaryValue* pref_value = updater.Get(); 589 DictionaryValue* pref_value = updater.Get();
602 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { 590 for (size_t i = 0; i < layouts_to_remove.size(); ++i) {
603 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); 591 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL);
604 } 592 }
605 } 593 }
606 594
607 } // namespace chromeos 595 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698