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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Returns true id the current user can write display preferences to | 70 // Returns true id the current user can write display preferences to |
71 // Local State. | 71 // Local State. |
72 bool UserCanSaveDisplayPreference() { | 72 bool UserCanSaveDisplayPreference() { |
73 UserManager* user_manager = UserManager::Get(); | 73 UserManager* user_manager = UserManager::Get(); |
74 return user_manager->IsUserLoggedIn() && | 74 return user_manager->IsUserLoggedIn() && |
75 (user_manager->IsLoggedInAsRegularUser() || | 75 (user_manager->IsLoggedInAsRegularUser() || |
76 user_manager->IsLoggedInAsLocallyManagedUser() || | 76 user_manager->IsLoggedInAsLocallyManagedUser() || |
77 user_manager->IsLoggedInAsKioskApp()); | 77 user_manager->IsLoggedInAsKioskApp()); |
78 } | 78 } |
79 | 79 |
80 ash::DisplayController* GetDisplayController() { | |
81 return ash::Shell::GetInstance()->display_controller(); | |
82 } | |
83 | |
84 void LoadDisplayLayouts() { | 80 void LoadDisplayLayouts() { |
85 PrefService* local_state = g_browser_process->local_state(); | 81 PrefService* local_state = g_browser_process->local_state(); |
86 ash::internal::DisplayLayoutStore* layout_store = | 82 ash::internal::DisplayLayoutStore* layout_store = |
87 GetDisplayManager()->layout_store(); | 83 GetDisplayManager()->layout_store(); |
88 | 84 |
89 const base::DictionaryValue* layouts = local_state->GetDictionary( | 85 const base::DictionaryValue* layouts = local_state->GetDictionary( |
90 prefs::kSecondaryDisplays); | 86 prefs::kSecondaryDisplays); |
91 for (DictionaryValue::Iterator it(*layouts); !it.IsAtEnd(); it.Advance()) { | 87 for (DictionaryValue::Iterator it(*layouts); !it.IsAtEnd(); it.Advance()) { |
92 ash::DisplayLayout layout; | 88 ash::DisplayLayout layout; |
93 if (!ash::DisplayLayout::ConvertFromValue(it.value(), &layout)) { | 89 if (!ash::DisplayLayout::ConvertFromValue(it.value(), &layout)) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 const ash::DisplayLayout& layout) { | 296 const ash::DisplayLayout& layout) { |
301 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 297 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
302 } | 298 } |
303 | 299 |
304 // Stores the given |power_state|. | 300 // Stores the given |power_state|. |
305 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 301 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
306 StoreDisplayPowerState(power_state); | 302 StoreDisplayPowerState(power_state); |
307 } | 303 } |
308 | 304 |
309 } // namespace chromeos | 305 } // namespace chromeos |
OLD | NEW |