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/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 // Screen lock default to off. | 244 // Screen lock default to off. |
245 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, | 245 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, |
246 false, | 246 false, |
247 PrefService::SYNCABLE_PREF); | 247 PrefService::SYNCABLE_PREF); |
248 | 248 |
249 // Secondary display layout. | 249 // Secondary display layout. |
250 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, | 250 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, |
251 static_cast<int>(DisplayController::RIGHT), | 251 static_cast<int>(DisplayController::RIGHT), |
252 PrefService::UNSYNCABLE_PREF); | 252 PrefService::UNSYNCABLE_PREF); |
| 253 // The offset of the secondary display position from the primary display. |
| 254 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, |
| 255 0, |
| 256 PrefService::UNSYNCABLE_PREF); |
253 | 257 |
254 // Mobile plan notifications default to on. | 258 // Mobile plan notifications default to on. |
255 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, | 259 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, |
256 true, | 260 true, |
257 PrefService::SYNCABLE_PREF); | 261 PrefService::SYNCABLE_PREF); |
258 | 262 |
259 // 3G first-time usage promo will be shown at least once. | 263 // 3G first-time usage promo will be shown at least once. |
260 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, | 264 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, |
261 true, | 265 true, |
262 PrefService::UNSYNCABLE_PREF); | 266 PrefService::UNSYNCABLE_PREF); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 xkb_auto_repeat_enabled_.Init( | 356 xkb_auto_repeat_enabled_.Init( |
353 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); | 357 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); |
354 xkb_auto_repeat_delay_pref_.Init( | 358 xkb_auto_repeat_delay_pref_.Init( |
355 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); | 359 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); |
356 xkb_auto_repeat_interval_pref_.Init( | 360 xkb_auto_repeat_interval_pref_.Init( |
357 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); | 361 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); |
358 | 362 |
359 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); | 363 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); |
360 | 364 |
361 secondary_display_layout_.Init(prefs::kSecondaryDisplayLayout, prefs, this); | 365 secondary_display_layout_.Init(prefs::kSecondaryDisplayLayout, prefs, this); |
| 366 secondary_display_offset_.Init(prefs::kSecondaryDisplayOffset, prefs, this); |
362 | 367 |
363 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this); | 368 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this); |
364 } | 369 } |
365 | 370 |
366 void Preferences::Init(PrefService* prefs) { | 371 void Preferences::Init(PrefService* prefs) { |
367 InitUserPrefs(prefs); | 372 InitUserPrefs(prefs); |
368 | 373 |
369 // Initialize preferences to currently saved state. | 374 // Initialize preferences to currently saved state. |
370 NotifyPrefChanged(NULL); | 375 NotifyPrefChanged(NULL); |
371 | 376 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 if (!pref_name || *pref_name == prefs::kSecondaryDisplayLayout) { | 585 if (!pref_name || *pref_name == prefs::kSecondaryDisplayLayout) { |
581 int layout = secondary_display_layout_.GetValue(); | 586 int layout = secondary_display_layout_.GetValue(); |
582 if (static_cast<int>(DisplayController::TOP) <= layout && | 587 if (static_cast<int>(DisplayController::TOP) <= layout && |
583 layout <= static_cast<int>(DisplayController::LEFT)) { | 588 layout <= static_cast<int>(DisplayController::LEFT)) { |
584 ash::Shell::GetInstance()->display_controller()-> | 589 ash::Shell::GetInstance()->display_controller()-> |
585 SetSecondaryDisplayLayout( | 590 SetSecondaryDisplayLayout( |
586 static_cast<DisplayController::SecondaryDisplayLayout>(layout)); | 591 static_cast<DisplayController::SecondaryDisplayLayout>(layout)); |
587 } | 592 } |
588 } | 593 } |
589 | 594 |
| 595 if (!pref_name || *pref_name == prefs::kSecondaryDisplayOffset) { |
| 596 ash::Shell::GetInstance()->display_controller()-> |
| 597 SetSecondaryDisplayOffset(secondary_display_offset_.GetValue()); |
| 598 } |
| 599 |
590 // Init or update protected content (DRM) support. | 600 // Init or update protected content (DRM) support. |
591 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { | 601 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { |
592 system::ToggleDrm(enable_drm_.GetValue()); | 602 system::ToggleDrm(enable_drm_.GetValue()); |
593 } | 603 } |
594 | 604 |
595 // Change the download directory to the default value if a GData directory is | 605 // Change the download directory to the default value if a GData directory is |
596 // selected and GData is disabled. | 606 // selected and GData is disabled. |
597 if (!pref_name || *pref_name == prefs::kDisableGData) { | 607 if (!pref_name || *pref_name == prefs::kDisableGData) { |
598 if (disable_gdata_.GetValue()) { | 608 if (disable_gdata_.GetValue()) { |
599 const FilePath download_path = | 609 const FilePath download_path = |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 707 |
698 input_method::AutoRepeatRate rate; | 708 input_method::AutoRepeatRate rate; |
699 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 709 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
700 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 710 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
701 DCHECK(rate.initial_delay_in_ms > 0); | 711 DCHECK(rate.initial_delay_in_ms > 0); |
702 DCHECK(rate.repeat_interval_in_ms > 0); | 712 DCHECK(rate.repeat_interval_in_ms > 0); |
703 input_method::XKeyboard::SetAutoRepeatRate(rate); | 713 input_method::XKeyboard::SetAutoRepeatRate(rate); |
704 } | 714 } |
705 | 715 |
706 } // namespace chromeos | 716 } // namespace chromeos |
OLD | NEW |