Chromium Code Reviews| 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" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/maximize_mode/maximize_mode_controller.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/prefs/scoped_user_pref_update.h" | 15 #include "base/prefs/scoped_user_pref_update.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 19 #include "base/values.h" | 20 #include "base/values.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chromeos/login/users/user_manager.h" | 22 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 // state respects to the current status (close/open) of the lid which can be | 303 // state respects to the current status (close/open) of the lid which can be |
| 303 // changed in any situation. See crbug.com/285360 | 304 // changed in any situation. See crbug.com/285360 |
| 304 StoreCurrentDisplayPowerState(); | 305 StoreCurrentDisplayPowerState(); |
| 305 | 306 |
| 306 // Do not store prefs when the confirmation dialog is shown. | 307 // Do not store prefs when the confirmation dialog is shown. |
| 307 if (!UserCanSaveDisplayPreference() || | 308 if (!UserCanSaveDisplayPreference() || |
| 308 ash::Shell::GetInstance()->resolution_notification_controller()-> | 309 ash::Shell::GetInstance()->resolution_notification_controller()-> |
| 309 DoesNotificationTimeout()) { | 310 DoesNotificationTimeout()) { |
| 310 return; | 311 return; |
| 311 } | 312 } |
| 313 | |
| 314 if (!ash::Shell::GetInstance()->ShouldSaveDisplaySettings()) | |
|
oshima
2014/05/23 19:15:05
Sorry if it wasn't clear. I wanted something like
jonross
2014/05/23 19:52:14
Done.
| |
| 315 return; | |
| 316 | |
| 312 StoreCurrentDisplayLayoutPrefs(); | 317 StoreCurrentDisplayLayoutPrefs(); |
| 313 StoreCurrentDisplayProperties(); | 318 StoreCurrentDisplayProperties(); |
| 314 } | 319 } |
| 315 | 320 |
| 316 void SetCurrentDisplayLayout(const ash::DisplayLayout& layout) { | 321 void SetCurrentDisplayLayout(const ash::DisplayLayout& layout) { |
| 317 GetDisplayManager()->SetLayoutForCurrentDisplays(layout); | 322 GetDisplayManager()->SetLayoutForCurrentDisplays(layout); |
| 318 } | 323 } |
| 319 | 324 |
| 320 void LoadDisplayPreferences(bool first_run_after_boot) { | 325 void LoadDisplayPreferences(bool first_run_after_boot) { |
| 321 LoadDisplayLayouts(); | 326 LoadDisplayLayouts(); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 338 const ash::DisplayLayout& layout) { | 343 const ash::DisplayLayout& layout) { |
| 339 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 344 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
| 340 } | 345 } |
| 341 | 346 |
| 342 // Stores the given |power_state|. | 347 // Stores the given |power_state|. |
| 343 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 348 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
| 344 StoreDisplayPowerState(power_state); | 349 StoreDisplayPowerState(power_state); |
| 345 } | 350 } |
| 346 | 351 |
| 347 } // namespace chromeos | 352 } // namespace chromeos |
| OLD | NEW |