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

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

Issue 10836046: Allow offset for secondary display position in chrome://settings/display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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" 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 // Screen lock default to off. 246 // Screen lock default to off.
247 prefs->RegisterBooleanPref(prefs::kEnableScreenLock, 247 prefs->RegisterBooleanPref(prefs::kEnableScreenLock,
248 false, 248 false,
249 PrefService::SYNCABLE_PREF); 249 PrefService::SYNCABLE_PREF);
250 250
251 // Secondary display layout. 251 // Secondary display layout.
252 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, 252 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayLayout,
253 static_cast<int>(DisplayController::RIGHT), 253 static_cast<int>(DisplayController::RIGHT),
254 PrefService::UNSYNCABLE_PREF); 254 PrefService::UNSYNCABLE_PREF);
255 // The offset of the secondary display position from the primary display.
256 prefs->RegisterIntegerPref(prefs::kSecondaryDisplayOffset,
257 0,
James Hawkins 2012/08/13 15:45:12 Optional nit: Condense parameters to save a line.
Jun Mukai 2012/08/14 01:50:40 I would follow the style in that file -- most of o
258 PrefService::UNSYNCABLE_PREF);
255 259
256 // Mobile plan notifications default to on. 260 // Mobile plan notifications default to on.
257 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, 261 prefs->RegisterBooleanPref(prefs::kShowPlanNotifications,
258 true, 262 true,
259 PrefService::SYNCABLE_PREF); 263 PrefService::SYNCABLE_PREF);
260 264
261 // 3G first-time usage promo will be shown at least once. 265 // 3G first-time usage promo will be shown at least once.
262 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, 266 prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification,
263 true, 267 true,
264 PrefService::UNSYNCABLE_PREF); 268 PrefService::UNSYNCABLE_PREF);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 xkb_auto_repeat_enabled_.Init( 358 xkb_auto_repeat_enabled_.Init(
355 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); 359 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
356 xkb_auto_repeat_delay_pref_.Init( 360 xkb_auto_repeat_delay_pref_.Init(
357 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); 361 prefs::kLanguageXkbAutoRepeatDelay, prefs, this);
358 xkb_auto_repeat_interval_pref_.Init( 362 xkb_auto_repeat_interval_pref_.Init(
359 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); 363 prefs::kLanguageXkbAutoRepeatInterval, prefs, this);
360 364
361 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); 365 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this);
362 366
363 secondary_display_layout_.Init(prefs::kSecondaryDisplayLayout, prefs, this); 367 secondary_display_layout_.Init(prefs::kSecondaryDisplayLayout, prefs, this);
368 secondary_display_offset_.Init(prefs::kSecondaryDisplayOffset, prefs, this);
364 369
365 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this); 370 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this);
366 } 371 }
367 372
368 void Preferences::Init(PrefService* prefs) { 373 void Preferences::Init(PrefService* prefs) {
369 InitUserPrefs(prefs); 374 InitUserPrefs(prefs);
370 375
371 // Initialize preferences to currently saved state. 376 // Initialize preferences to currently saved state.
372 NotifyPrefChanged(NULL); 377 NotifyPrefChanged(NULL);
373 378
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (!pref_name || *pref_name == prefs::kSecondaryDisplayLayout) { 587 if (!pref_name || *pref_name == prefs::kSecondaryDisplayLayout) {
583 int layout = secondary_display_layout_.GetValue(); 588 int layout = secondary_display_layout_.GetValue();
584 if (static_cast<int>(DisplayController::TOP) <= layout && 589 if (static_cast<int>(DisplayController::TOP) <= layout &&
585 layout <= static_cast<int>(DisplayController::LEFT)) { 590 layout <= static_cast<int>(DisplayController::LEFT)) {
586 ash::Shell::GetInstance()->display_controller()-> 591 ash::Shell::GetInstance()->display_controller()->
587 SetSecondaryDisplayLayout( 592 SetSecondaryDisplayLayout(
588 static_cast<DisplayController::SecondaryDisplayLayout>(layout)); 593 static_cast<DisplayController::SecondaryDisplayLayout>(layout));
589 } 594 }
590 } 595 }
591 596
597 if (!pref_name || *pref_name == prefs::kSecondaryDisplayOffset) {
598 ash::Shell::GetInstance()->display_controller()->
599 SetSecondaryDisplayOffset(secondary_display_offset_.GetValue());
600 }
601
592 // Init or update protected content (DRM) support. 602 // Init or update protected content (DRM) support.
593 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { 603 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) {
594 system::ToggleDrm(enable_drm_.GetValue()); 604 system::ToggleDrm(enable_drm_.GetValue());
595 } 605 }
596 606
597 // Change the download directory to the default value if a GData directory is 607 // Change the download directory to the default value if a GData directory is
598 // selected and GData is disabled. 608 // selected and GData is disabled.
599 if (!pref_name || *pref_name == prefs::kDisableGData) { 609 if (!pref_name || *pref_name == prefs::kDisableGData) {
600 if (disable_gdata_.GetValue()) { 610 if (disable_gdata_.GetValue()) {
601 const FilePath download_path = 611 const FilePath download_path =
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 709
700 input_method::AutoRepeatRate rate; 710 input_method::AutoRepeatRate rate;
701 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); 711 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue();
702 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); 712 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue();
703 DCHECK(rate.initial_delay_in_ms > 0); 713 DCHECK(rate.initial_delay_in_ms > 0);
704 DCHECK(rate.repeat_interval_in_ms > 0); 714 DCHECK(rate.repeat_interval_in_ms > 0);
705 input_method::XKeyboard::SetAutoRepeatRate(rate); 715 input_method::XKeyboard::SetAutoRepeatRate(rate);
706 } 716 }
707 717
708 } // namespace chromeos 718 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698