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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 if (pref_data->HasKey(name)) { | 218 if (pref_data->HasKey(name)) { |
219 base::Value* value = NULL; | 219 base::Value* value = NULL; |
220 if (pref_data->Get(name, &value) && value != NULL) | 220 if (pref_data->Get(name, &value) && value != NULL) |
221 layout_value.reset(value->DeepCopy()); | 221 layout_value.reset(value->DeepCopy()); |
222 } | 222 } |
223 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get())) | 223 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get())) |
224 pref_data->Set(name, layout_value.release()); | 224 pref_data->Set(name, layout_value.release()); |
225 } | 225 } |
226 | 226 |
227 void StoreCurrentDisplayLayoutPrefs() { | 227 void StoreCurrentDisplayLayoutPrefs() { |
| 228 ash::DisplayManager* display_manager = GetDisplayManager(); |
228 if (!UserCanSaveDisplayPreference() || | 229 if (!UserCanSaveDisplayPreference() || |
229 GetDisplayManager()->num_connected_displays() < 2) { | 230 display_manager->num_connected_displays() < 2 || |
| 231 display_manager->IsInUnifiedMode()) { |
230 return; | 232 return; |
231 } | 233 } |
232 | 234 |
233 ash::DisplayIdPair pair = GetDisplayManager()->GetCurrentDisplayIdPair(); | 235 ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); |
234 ash::DisplayLayout display_layout = | 236 ash::DisplayLayout display_layout = |
235 GetDisplayManager()->layout_store()->GetRegisteredDisplayLayout(pair); | 237 display_manager->layout_store()->GetRegisteredDisplayLayout(pair); |
236 StoreDisplayLayoutPref(pair, display_layout); | 238 StoreDisplayLayoutPref(pair, display_layout); |
237 } | 239 } |
238 | 240 |
239 void StoreCurrentDisplayProperties() { | 241 void StoreCurrentDisplayProperties() { |
240 ash::DisplayManager* display_manager = GetDisplayManager(); | 242 ash::DisplayManager* display_manager = GetDisplayManager(); |
241 PrefService* local_state = g_browser_process->local_state(); | 243 PrefService* local_state = g_browser_process->local_state(); |
242 | 244 |
243 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); | 245 DictionaryPrefUpdate update(local_state, prefs::kDisplayProperties); |
244 base::DictionaryValue* pref_data = update.Get(); | 246 base::DictionaryValue* pref_data = update.Get(); |
245 | 247 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 const ash::DisplayLayout& layout) { | 392 const ash::DisplayLayout& layout) { |
391 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 393 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
392 } | 394 } |
393 | 395 |
394 // Stores the given |power_state|. | 396 // Stores the given |power_state|. |
395 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 397 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
396 StoreDisplayPowerState(power_state); | 398 StoreDisplayPowerState(power_state); |
397 } | 399 } |
398 | 400 |
399 } // namespace chromeos | 401 } // namespace chromeos |
OLD | NEW |