Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Side by Side Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 1150913002: Save and restore unified mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix leak Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/prefs/scoped_user_pref_update.h" 13 #include "base/prefs/scoped_user_pref_update.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/sys_info.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/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "components/user_manager/user_manager.h" 22 #include "components/user_manager/user_manager.h"
22 #include "third_party/cros_system_api/dbus/service_constants.h" 23 #include "third_party/cros_system_api/dbus/service_constants.h"
23 #include "ui/gfx/display.h" 24 #include "ui/gfx/display.h"
24 #include "ui/gfx/geometry/insets.h" 25 #include "ui/gfx/geometry/insets.h"
25 #include "ui/gfx/screen.h" 26 #include "ui/gfx/screen.h"
26 #include "url/url_canon.h" 27 #include "url/url_canon.h"
27 #include "url/url_util.h" 28 #include "url/url_util.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (pref_data->Get(name, &value) && value != NULL) 221 if (pref_data->Get(name, &value) && value != NULL)
221 layout_value.reset(value->DeepCopy()); 222 layout_value.reset(value->DeepCopy());
222 } 223 }
223 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get())) 224 if (ash::DisplayLayout::ConvertToValue(display_layout, layout_value.get()))
224 pref_data->Set(name, layout_value.release()); 225 pref_data->Set(name, layout_value.release());
225 } 226 }
226 227
227 void StoreCurrentDisplayLayoutPrefs() { 228 void StoreCurrentDisplayLayoutPrefs() {
228 ash::DisplayManager* display_manager = GetDisplayManager(); 229 ash::DisplayManager* display_manager = GetDisplayManager();
229 if (!UserCanSaveDisplayPreference() || 230 if (!UserCanSaveDisplayPreference() ||
230 display_manager->num_connected_displays() < 2 || 231 display_manager->num_connected_displays() < 2) {
231 display_manager->IsInUnifiedMode()) {
232 return; 232 return;
233 } 233 }
234 234
235 ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); 235 ash::DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair();
236 ash::DisplayLayout display_layout = 236 ash::DisplayLayout display_layout =
237 display_manager->layout_store()->GetRegisteredDisplayLayout(pair); 237 display_manager->layout_store()->GetRegisteredDisplayLayout(pair);
238 StoreDisplayLayoutPref(pair, display_layout); 238 StoreDisplayLayoutPref(pair, display_layout);
239 } 239 }
240 240
241 void StoreCurrentDisplayProperties() { 241 void StoreCurrentDisplayProperties() {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 const ash::DisplayLayout& layout) { 392 const ash::DisplayLayout& layout) {
393 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); 393 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout);
394 } 394 }
395 395
396 // Stores the given |power_state|. 396 // Stores the given |power_state|.
397 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { 397 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) {
398 StoreDisplayPowerState(power_state); 398 StoreDisplayPowerState(power_state);
399 } 399 }
400 400
401 } // namespace chromeos 401 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/test/display_manager_test_api.cc ('k') | chrome/browser/chromeos/display/display_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698