| 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/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_pref_util.h" | 10 #include "ash/display/display_pref_util.h" |
| 11 #include "ash/display/resolution_notification_controller.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry) { | 252 void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry) { |
| 252 // Per-display preference. | 253 // Per-display preference. |
| 253 registry->RegisterDictionaryPref(prefs::kSecondaryDisplays); | 254 registry->RegisterDictionaryPref(prefs::kSecondaryDisplays); |
| 254 registry->RegisterDictionaryPref(prefs::kDisplayProperties); | 255 registry->RegisterDictionaryPref(prefs::kDisplayProperties); |
| 255 DisplayPowerStateToStringMap::const_iterator iter = | 256 DisplayPowerStateToStringMap::const_iterator iter = |
| 256 GetDisplayPowerStateToStringMap()->find(chromeos::DISPLAY_POWER_ALL_ON); | 257 GetDisplayPowerStateToStringMap()->find(chromeos::DISPLAY_POWER_ALL_ON); |
| 257 registry->RegisterStringPref(prefs::kDisplayPowerState, iter->second); | 258 registry->RegisterStringPref(prefs::kDisplayPowerState, iter->second); |
| 258 } | 259 } |
| 259 | 260 |
| 260 void StoreDisplayPrefs() { | 261 void StoreDisplayPrefs() { |
| 261 if (!IsValidUser()) | 262 // Do not store prefs when the confirmation dialog is shown. |
| 263 if (!IsValidUser() || |
| 264 ash::Shell::GetInstance()->resolution_notification_controller()-> |
| 265 DoesNotificationTimeout()) { |
| 262 return; | 266 return; |
| 267 } |
| 263 StoreCurrentDisplayLayoutPrefs(); | 268 StoreCurrentDisplayLayoutPrefs(); |
| 264 StoreCurrentDisplayProperties(); | 269 StoreCurrentDisplayProperties(); |
| 265 StoreCurrentDisplayPowerState(); | 270 StoreCurrentDisplayPowerState(); |
| 266 } | 271 } |
| 267 | 272 |
| 268 void SetCurrentDisplayLayout(const ash::DisplayLayout& layout) { | 273 void SetCurrentDisplayLayout(const ash::DisplayLayout& layout) { |
| 269 ash::DisplayController* display_controller = GetDisplayController(); | 274 ash::DisplayController* display_controller = GetDisplayController(); |
| 270 display_controller->SetLayoutForCurrentDisplays(layout); | 275 display_controller->SetLayoutForCurrentDisplays(layout); |
| 271 } | 276 } |
| 272 | 277 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 291 const ash::DisplayLayout& layout) { | 296 const ash::DisplayLayout& layout) { |
| 292 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 297 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
| 293 } | 298 } |
| 294 | 299 |
| 295 // Stores the given |power_state|. | 300 // Stores the given |power_state|. |
| 296 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 301 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
| 297 StoreDisplayPowerState(power_state); | 302 StoreDisplayPowerState(power_state); |
| 298 } | 303 } |
| 299 | 304 |
| 300 } // namespace chromeos | 305 } // namespace chromeos |
| OLD | NEW |