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 "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/prefs/scoped_user_pref_update.h" | 14 #include "base/prefs/scoped_user_pref_update.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "third_party/cros_system_api/dbus/service_constants.h" | 23 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 24 #include "ui/display/types/display_constants.h" |
24 #include "ui/gfx/display.h" | 25 #include "ui/gfx/display.h" |
25 #include "ui/gfx/insets.h" | 26 #include "ui/gfx/insets.h" |
26 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
27 #include "url/url_canon.h" | 28 #include "url/url_canon.h" |
28 #include "url/url_util.h" | 29 #include "url/url_util.h" |
29 | 30 |
30 namespace chromeos { | 31 namespace chromeos { |
31 namespace { | 32 namespace { |
32 | 33 |
33 const char kInsetsTopKey[] = "insets_top"; | 34 const char kInsetsTopKey[] = "insets_top"; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 base::DictionaryValue* pref_data = update.Get(); | 223 base::DictionaryValue* pref_data = update.Get(); |
223 | 224 |
224 size_t num = display_manager->GetNumDisplays(); | 225 size_t num = display_manager->GetNumDisplays(); |
225 for (size_t i = 0; i < num; ++i) { | 226 for (size_t i = 0; i < num; ++i) { |
226 const gfx::Display& display = display_manager->GetDisplayAt(i); | 227 const gfx::Display& display = display_manager->GetDisplayAt(i); |
227 int64 id = display.id(); | 228 int64 id = display.id(); |
228 ash::DisplayInfo info = display_manager->GetDisplayInfo(id); | 229 ash::DisplayInfo info = display_manager->GetDisplayInfo(id); |
229 | 230 |
230 scoped_ptr<base::DictionaryValue> property_value( | 231 scoped_ptr<base::DictionaryValue> property_value( |
231 new base::DictionaryValue()); | 232 new base::DictionaryValue()); |
232 property_value->SetInteger("rotation", static_cast<int>(info.rotation())); | 233 property_value->SetInteger("rotation", static_cast<int>(info.GetRotation( |
| 234 ui::USER))); |
233 property_value->SetInteger( | 235 property_value->SetInteger( |
234 "ui-scale", | 236 "ui-scale", |
235 static_cast<int>(info.configured_ui_scale() * 1000)); | 237 static_cast<int>(info.configured_ui_scale() * 1000)); |
236 ash::DisplayMode mode; | 238 ash::DisplayMode mode; |
237 if (!display.IsInternal() && | 239 if (!display.IsInternal() && |
238 display_manager->GetSelectedModeForDisplayId(id, &mode) && | 240 display_manager->GetSelectedModeForDisplayId(id, &mode) && |
239 !mode.native) { | 241 !mode.native) { |
240 property_value->SetInteger("width", mode.size.width()); | 242 property_value->SetInteger("width", mode.size.width()); |
241 property_value->SetInteger("height", mode.size.height()); | 243 property_value->SetInteger("height", mode.size.height()); |
242 } | 244 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const ash::DisplayLayout& layout) { | 340 const ash::DisplayLayout& layout) { |
339 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); | 341 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); |
340 } | 342 } |
341 | 343 |
342 // Stores the given |power_state|. | 344 // Stores the given |power_state|. |
343 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { | 345 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { |
344 StoreDisplayPowerState(power_state); | 346 StoreDisplayPowerState(power_state); |
345 } | 347 } |
346 | 348 |
347 } // namespace chromeos | 349 } // namespace chromeos |
OLD | NEW |