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

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, 2 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 | 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" 20 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/chromeos/system/touchpad_settings.h" 21 #include "chrome/browser/chromeos/system/touchpad_settings.h"
22 #include "chrome/browser/prefs/pref_member.h" 22 #include "chrome/browser/prefs/pref_member.h"
23 #include "chrome/browser/prefs/pref_service.h" 23 #include "chrome/browser/prefs/pref_service.h"
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" 24 #include "chrome/browser/prefs/scoped_user_pref_update.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #include "content/browser/browser_thread.h"
28 #include "content/public/browser/notification_details.h" 29 #include "content/public/browser/notification_details.h"
29 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
31 #include "googleurl/src/gurl.h"
30 #include "unicode/timezone.h" 32 #include "unicode/timezone.h"
31 33
32 namespace chromeos { 34 namespace chromeos {
33 35
34 static const char kFallbackInputMethodLocale[] = "en-US"; 36 static const char kFallbackInputMethodLocale[] = "en-US";
35 37
36 Preferences::Preferences() {} 38 Preferences::Preferences() {}
37 39
38 Preferences::~Preferences() {} 40 Preferences::~Preferences() {}
39 41
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Mobile plan notifications default to on. 190 // Mobile plan notifications default to on.
189 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, 191 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications,
190 true, 192 true,
191 PrefService::SYNCABLE_PREF); 193 PrefService::SYNCABLE_PREF);
192 194
193 // 3G first-time usage promo will be shown at least once. 195 // 3G first-time usage promo will be shown at least once.
194 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, 196 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification,
195 true, 197 true,
196 PrefService::UNSYNCABLE_PREF); 198 PrefService::UNSYNCABLE_PREF);
197 199
198 // Use shared proxies default to off. 200 // Use shared proxies default to off if user is logged in and true otherwise.
201 // UseManager::Get() must be called on UI thread.
202 bool default_use_shared_proxies =
203 !(BrowserThread::CurrentlyOn(BrowserThread::UI) &&
Mattias Nissler (ping if slow) 2011/10/25 12:43:11 Shouldn't this at least be a DCHECK? I guess you d
204 UserManager::Get()->user_is_logged_in());
199 prefs->RegisterBooleanPref(prefs::kUseSharedProxies, 205 prefs->RegisterBooleanPref(prefs::kUseSharedProxies,
200 false, 206 default_use_shared_proxies,
201 PrefService::SYNCABLE_PREF); 207 PrefService::SYNCABLE_PREF);
202 208
203 // OAuth1 all access token and secret pair. 209 // OAuth1 all access token and secret pair.
204 prefs->RegisterStringPref(prefs::kOAuth1Token, 210 prefs->RegisterStringPref(prefs::kOAuth1Token,
205 "", 211 "",
206 PrefService::UNSYNCABLE_PREF); 212 PrefService::UNSYNCABLE_PREF);
207 prefs->RegisterStringPref(prefs::kOAuth1Secret, 213 prefs->RegisterStringPref(prefs::kOAuth1Secret,
208 "", 214 "",
209 PrefService::UNSYNCABLE_PREF); 215 PrefService::UNSYNCABLE_PREF);
210 } 216 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); 274 prefs::kLanguageXkbRemapAltKeyTo, prefs, this);
269 language_xkb_auto_repeat_enabled_.Init( 275 language_xkb_auto_repeat_enabled_.Init(
270 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); 276 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
271 language_xkb_auto_repeat_delay_pref_.Init( 277 language_xkb_auto_repeat_delay_pref_.Init(
272 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); 278 prefs::kLanguageXkbAutoRepeatDelay, prefs, this);
273 language_xkb_auto_repeat_interval_pref_.Init( 279 language_xkb_auto_repeat_interval_pref_.Init(
274 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); 280 prefs::kLanguageXkbAutoRepeatInterval, prefs, this);
275 281
276 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); 282 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this);
277 283
278 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this);
279
280 // Initialize preferences to currently saved state. 284 // Initialize preferences to currently saved state.
281 NotifyPrefChanged(NULL); 285 NotifyPrefChanged(NULL);
282 286
283 // Initialize virtual keyboard settings to currently saved state. 287 // Initialize virtual keyboard settings to currently saved state.
284 UpdateVirturalKeyboardPreference(prefs); 288 UpdateVirturalKeyboardPreference(prefs);
285 289
286 // If a guest is logged in, initialize the prefs as if this is the first 290 // If a guest is logged in, initialize the prefs as if this is the first
287 // login. 291 // login.
288 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { 292 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
289 LoginUtils::Get()->SetFirstLoginPrefs(prefs); 293 LoginUtils::Get()->SetFirstLoginPrefs(prefs);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, 463 language_prefs::kMozcIntegerPrefs[i].ibus_config_name,
460 language_mozc_integer_prefs_[i].GetValue()); 464 language_mozc_integer_prefs_[i].GetValue());
461 } 465 }
462 } 466 }
463 467
464 // Init or update power manager config. 468 // Init or update power manager config.
465 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { 469 if (!pref_name || *pref_name == prefs::kEnableScreenLock) {
466 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock( 470 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock(
467 enable_screen_lock_.GetValue()); 471 enable_screen_lock_.GetValue());
468 } 472 }
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 } 473 }
475 474
476 void Preferences::SetLanguageConfigBoolean(const char* section, 475 void Preferences::SetLanguageConfigBoolean(const char* section,
477 const char* name, 476 const char* name,
478 bool value) { 477 bool value) {
479 input_method::ImeConfigValue config; 478 input_method::ImeConfigValue config;
480 config.type = input_method::ImeConfigValue::kValueTypeBool; 479 config.type = input_method::ImeConfigValue::kValueTypeBool;
481 config.bool_value = value; 480 config.bool_value = value;
482 input_method::InputMethodManager::GetInstance()-> 481 input_method::InputMethodManager::GetInstance()->
483 SetImeConfig(section, name, config); 482 SetImeConfig(section, name, config);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 597
599 // Remove invalid prefs. 598 // Remove invalid prefs.
600 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); 599 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard);
601 DictionaryValue* pref_value = updater.Get(); 600 DictionaryValue* pref_value = updater.Get();
602 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { 601 for (size_t i = 0; i < layouts_to_remove.size(); ++i) {
603 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); 602 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL);
604 } 603 }
605 } 604 }
606 605
607 } // namespace chromeos 606 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698