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

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

Issue 10829034: Store secondary display layout to the user's preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 8 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 | Annotate | Revision Log
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/chromeos/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include "ash/display/display_controller.h"
8 #include "ash/shell.h"
7 #include "base/chromeos/chromeos_version.h" 9 #include "base/chromeos/chromeos_version.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
10 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
11 #include "base/string_split.h" 13 #include "base/string_split.h"
12 #include "base/string_util.h" 14 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/gdata/gdata_util.h" 17 #include "chrome/browser/chromeos/gdata/gdata_util.h"
16 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
(...skipping 23 matching lines...) Expand all
40 // TODO(achuith): Use a cmd-line flag + use flags for this instead. 42 // TODO(achuith): Use a cmd-line flag + use flags for this instead.
41 bool IsLumpy() { 43 bool IsLumpy() {
42 std::string board; 44 std::string board;
43 system::StatisticsProvider::GetInstance()->GetMachineStatistic( 45 system::StatisticsProvider::GetInstance()->GetMachineStatistic(
44 "CHROMEOS_RELEASE_BOARD", &board); 46 "CHROMEOS_RELEASE_BOARD", &board);
45 return StartsWithASCII(board, "lumpy", false); 47 return StartsWithASCII(board, "lumpy", false);
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 51
52 using ash::internal::DisplayController;
53
50 static const char kFallbackInputMethodLocale[] = "en-US"; 54 static const char kFallbackInputMethodLocale[] = "en-US";
51 55
52 Preferences::Preferences() 56 Preferences::Preferences()
53 : prefs_(NULL), 57 : prefs_(NULL),
54 input_method_manager_(input_method::InputMethodManager::GetInstance()) { 58 input_method_manager_(input_method::InputMethodManager::GetInstance()) {
55 } 59 }
56 60
57 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) 61 Preferences::Preferences(input_method::InputMethodManager* input_method_manager)
58 : input_method_manager_(input_method_manager) { 62 : input_method_manager_(input_method_manager) {
59 } 63 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 PrefService::UNSYNCABLE_PREF); 239 PrefService::UNSYNCABLE_PREF);
236 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, 240 prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval,
237 language_prefs::kXkbAutoRepeatIntervalInMs, 241 language_prefs::kXkbAutoRepeatIntervalInMs,
238 PrefService::UNSYNCABLE_PREF); 242 PrefService::UNSYNCABLE_PREF);
239 243
240 // Screen lock default to off. 244 // Screen lock default to off.
241 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, 245 prefs->RegisterBooleanPref(prefs::kEnableScreenLock,
242 false, 246 false,
243 PrefService::SYNCABLE_PREF); 247 PrefService::SYNCABLE_PREF);
244 248
249 // Secondary display layout.
250 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayLayout,
251 static_cast<int>(DisplayController::RIGHT),
252 PrefService::UNSYNCABLE_PREF);
253
245 // Mobile plan notifications default to on. 254 // Mobile plan notifications default to on.
246 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, 255 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications,
247 true, 256 true,
248 PrefService::SYNCABLE_PREF); 257 PrefService::SYNCABLE_PREF);
249 258
250 // 3G first-time usage promo will be shown at least once. 259 // 3G first-time usage promo will be shown at least once.
251 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, 260 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification,
252 true, 261 true,
253 PrefService::UNSYNCABLE_PREF); 262 PrefService::UNSYNCABLE_PREF);
254 263
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 351 }
343 xkb_auto_repeat_enabled_.Init( 352 xkb_auto_repeat_enabled_.Init(
344 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); 353 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
345 xkb_auto_repeat_delay_pref_.Init( 354 xkb_auto_repeat_delay_pref_.Init(
346 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); 355 prefs::kLanguageXkbAutoRepeatDelay, prefs, this);
347 xkb_auto_repeat_interval_pref_.Init( 356 xkb_auto_repeat_interval_pref_.Init(
348 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); 357 prefs::kLanguageXkbAutoRepeatInterval, prefs, this);
349 358
350 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); 359 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this);
351 360
361 secondary_display_layout_.Init(prefs::kSecondaryDisplayLayout, prefs, this);
362
352 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this); 363 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this);
353 } 364 }
354 365
355 void Preferences::Init(PrefService* prefs) { 366 void Preferences::Init(PrefService* prefs) {
356 InitUserPrefs(prefs); 367 InitUserPrefs(prefs);
357 368
358 // Initialize preferences to currently saved state. 369 // Initialize preferences to currently saved state.
359 NotifyPrefChanged(NULL); 370 NotifyPrefChanged(NULL);
360 371
361 // If a guest is logged in, initialize the prefs as if this is the first 372 // If a guest is logged in, initialize the prefs as if this is the first
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 mozc_integer_prefs_[i].GetValue()); 570 mozc_integer_prefs_[i].GetValue());
560 } 571 }
561 } 572 }
562 573
563 // Init or update power manager config. 574 // Init or update power manager config.
564 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { 575 if (!pref_name || *pref_name == prefs::kEnableScreenLock) {
565 system::power_manager_settings::EnableScreenLock( 576 system::power_manager_settings::EnableScreenLock(
566 enable_screen_lock_.GetValue()); 577 enable_screen_lock_.GetValue());
567 } 578 }
568 579
580 if (!pref_name || *pref_name == prefs::kSecondaryDisplayLayout) {
581 int layout = secondary_display_layout_.GetValue();
582 if (static_cast<int>(DisplayController::TOP) <= layout &&
583 layout <= static_cast<int>(DisplayController::LEFT)) {
584 ash::Shell::GetInstance()->display_controller()->
585 SetSecondaryDisplayLayout(
586 static_cast<DisplayController::SecondaryDisplayLayout>(layout));
587 }
588 }
589
569 // Init or update protected content (DRM) support. 590 // Init or update protected content (DRM) support.
570 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { 591 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) {
571 system::ToggleDrm(enable_drm_.GetValue()); 592 system::ToggleDrm(enable_drm_.GetValue());
572 } 593 }
573 594
574 // Change the download directory to the default value if a GData directory is 595 // Change the download directory to the default value if a GData directory is
575 // selected and GData is disabled. 596 // selected and GData is disabled.
576 if (!pref_name || *pref_name == prefs::kDisableGData) { 597 if (!pref_name || *pref_name == prefs::kDisableGData) {
577 if (disable_gdata_.GetValue()) { 598 if (disable_gdata_.GetValue()) {
578 const FilePath download_path = 599 const FilePath download_path =
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 697
677 input_method::AutoRepeatRate rate; 698 input_method::AutoRepeatRate rate;
678 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); 699 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue();
679 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); 700 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue();
680 DCHECK(rate.initial_delay_in_ms > 0); 701 DCHECK(rate.initial_delay_in_ms > 0);
681 DCHECK(rate.repeat_interval_in_ms > 0); 702 DCHECK(rate.repeat_interval_in_ms > 0);
682 input_method::XKeyboard::SetAutoRepeatRate(rate); 703 input_method::XKeyboard::SetAutoRepeatRate(rate);
683 } 704 }
684 705
685 } // namespace chromeos 706 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698