| 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_layout_store.h" | 7 #include "ash/display/display_layout_store.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/display_pref_util.h" | 9 #include "ash/display/display_pref_util.h" |
| 10 #include "ash/display/resolution_notification_controller.h" | 10 #include "ash/display/resolution_notification_controller.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 const DisplayPowerStateToStringMap* map = GetDisplayPowerStateToStringMap(); | 276 const DisplayPowerStateToStringMap* map = GetDisplayPowerStateToStringMap(); |
| 277 DisplayPowerStateToStringMap::const_iterator iter = map->find(power_state); | 277 DisplayPowerStateToStringMap::const_iterator iter = map->find(power_state); |
| 278 if (iter != map->end()) { | 278 if (iter != map->end()) { |
| 279 PrefService* local_state = g_browser_process->local_state(); | 279 PrefService* local_state = g_browser_process->local_state(); |
| 280 local_state->SetString(prefs::kDisplayPowerState, iter->second); | 280 local_state->SetString(prefs::kDisplayPowerState, iter->second); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void StoreCurrentDisplayPowerState() { | 284 void StoreCurrentDisplayPowerState() { |
| 285 StoreDisplayPowerState( | 285 StoreDisplayPowerState( |
| 286 ash::Shell::GetInstance()->output_configurator()->power_state()); | 286 ash::Shell::GetInstance()->display_configurator()->power_state()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace | 289 } // namespace |
| 290 | 290 |
| 291 void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry) { | 291 void RegisterDisplayLocalStatePrefs(PrefRegistrySimple* registry) { |
| 292 // Per-display preference. | 292 // Per-display preference. |
| 293 registry->RegisterDictionaryPref(prefs::kSecondaryDisplays); | 293 registry->RegisterDictionaryPref(prefs::kSecondaryDisplays); |
| 294 registry->RegisterDictionaryPref(prefs::kDisplayProperties); | 294 registry->RegisterDictionaryPref(prefs::kDisplayProperties); |
| 295 DisplayPowerStateToStringMap::const_iterator iter = | 295 DisplayPowerStateToStringMap::const_iterator iter = |
| 296 GetDisplayPowerStateToStringMap()->find(chromeos::DISPLAY_POWER_ALL_ON); | 296 GetDisplayPowerStateToStringMap()->find(chromeos::DISPLAY_POWER_ALL_ON); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 319 | 319 |
| 320 void LoadDisplayPreferences(bool first_run_after_boot) { | 320 void LoadDisplayPreferences(bool first_run_after_boot) { |
| 321 LoadDisplayLayouts(); | 321 LoadDisplayLayouts(); |
| 322 LoadDisplayProperties(); | 322 LoadDisplayProperties(); |
| 323 if (!first_run_after_boot) { | 323 if (!first_run_after_boot) { |
| 324 PrefService* local_state = g_browser_process->local_state(); | 324 PrefService* local_state = g_browser_process->local_state(); |
| 325 // Restore DisplayPowerState: | 325 // Restore DisplayPowerState: |
| 326 std::string value = local_state->GetString(prefs::kDisplayPowerState); | 326 std::string value = local_state->GetString(prefs::kDisplayPowerState); |
| 327 chromeos::DisplayPowerState power_state; | 327 chromeos::DisplayPowerState power_state; |
| 328 if (GetDisplayPowerStateFromString(value, &power_state)) { | 328 if (GetDisplayPowerStateFromString(value, &power_state)) { |
| 329 ash::Shell::GetInstance()->output_configurator()->SetInitialDisplayPower( | 329 ash::Shell::GetInstance()->display_configurator()->SetInitialDisplayPower( |
| 330 power_state); | 330 power_state); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 // Stores the display layout for given display pairs. | 335 // Stores the display layout for given display pairs. |
| 336 void StoreDisplayLayoutPrefForTest(int64 id1, | 336 void StoreDisplayLayoutPrefForTest(int64 id1, |
| 337 int64 id2, | 337 int64 id2, |
| 338 const ash::DisplayLayout& layout) { | 338 const ash::DisplayLayout& layout) { |
| 339 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 339 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
| 340 } | 340 } |
| 341 | 341 |
| 342 // Stores the given |power_state|. | 342 // Stores the given |power_state|. |
| 343 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 343 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
| 344 StoreDisplayPowerState(power_state); | 344 StoreDisplayPowerState(power_state); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace chromeos | 347 } // namespace chromeos |
| OLD | NEW |