| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 new base::DictionaryValue()); | 147 new base::DictionaryValue()); |
| 148 layout_value->SetBoolean(key, value != nullptr); | 148 layout_value->SetBoolean(key, value != nullptr); |
| 149 pref_data->Set(name, layout_value.release()); | 149 pref_data->Set(name, layout_value.release()); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 void StoreDisplayBoolPropertyForList(const display::DisplayIdList& list, | 153 void StoreDisplayBoolPropertyForList(const display::DisplayIdList& list, |
| 154 const std::string& key, | 154 const std::string& key, |
| 155 bool value) { | 155 bool value) { |
| 156 StoreDisplayPropertyForList( | 156 StoreDisplayPropertyForList( |
| 157 list, key, base::WrapUnique(new base::FundamentalValue(value))); | 157 list, key, base::MakeUnique<base::FundamentalValue>(value)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void StoreDisplayLayoutPrefForList(const display::DisplayIdList& list, | 160 void StoreDisplayLayoutPrefForList(const display::DisplayIdList& list, |
| 161 display::DisplayPlacement::Position layout, | 161 display::DisplayPlacement::Position layout, |
| 162 int offset) { | 162 int offset) { |
| 163 StoreDisplayLayoutPrefForList(list, layout, offset, list[0]); | 163 StoreDisplayLayoutPrefForList(list, layout, offset, list[0]); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void StoreDisplayOverscan(int64_t id, const gfx::Insets& insets) { | 166 void StoreDisplayOverscan(int64_t id, const gfx::Insets& insets) { |
| 167 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties); | 167 DictionaryPrefUpdate update(&local_state_, prefs::kDisplayProperties); |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 EXPECT_FALSE(stored_layout.default_unified); | 1029 EXPECT_FALSE(stored_layout.default_unified); |
| 1030 EXPECT_FALSE(stored_layout.mirrored); | 1030 EXPECT_FALSE(stored_layout.mirrored); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) { | 1033 TEST_F(DisplayPreferencesTest, RestoreUnifiedMode) { |
| 1034 int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 1034 int64_t id1 = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 1035 display::DisplayIdList list = ash::test::CreateDisplayIdList2(id1, id1 + 1); | 1035 display::DisplayIdList list = ash::test::CreateDisplayIdList2(id1, id1 + 1); |
| 1036 StoreDisplayBoolPropertyForList(list, "default_unified", true); | 1036 StoreDisplayBoolPropertyForList(list, "default_unified", true); |
| 1037 StoreDisplayPropertyForList( | 1037 StoreDisplayPropertyForList( |
| 1038 list, "primary-id", | 1038 list, "primary-id", |
| 1039 base::WrapUnique(new base::StringValue(base::Int64ToString(id1)))); | 1039 base::MakeUnique<base::StringValue>(base::Int64ToString(id1))); |
| 1040 LoadDisplayPreferences(false); | 1040 LoadDisplayPreferences(false); |
| 1041 | 1041 |
| 1042 // Should not restore to unified unless unified desktop is enabled. | 1042 // Should not restore to unified unless unified desktop is enabled. |
| 1043 UpdateDisplay("100x100,200x200"); | 1043 UpdateDisplay("100x100,200x200"); |
| 1044 ash::DisplayManager* display_manager = | 1044 ash::DisplayManager* display_manager = |
| 1045 ash::Shell::GetInstance()->display_manager(); | 1045 ash::Shell::GetInstance()->display_manager(); |
| 1046 EXPECT_FALSE(display_manager->IsInUnifiedMode()); | 1046 EXPECT_FALSE(display_manager->IsInUnifiedMode()); |
| 1047 | 1047 |
| 1048 // Restored to unified. | 1048 // Restored to unified. |
| 1049 display_manager->SetUnifiedDesktopEnabled(true); | 1049 display_manager->SetUnifiedDesktopEnabled(true); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 | 1119 |
| 1120 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), | 1120 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), |
| 1121 display_manager->GetDisplayForId(list[0]).bounds()); | 1121 display_manager->GetDisplayForId(list[0]).bounds()); |
| 1122 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), | 1122 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), |
| 1123 display_manager->GetDisplayForId(list[1]).bounds()); | 1123 display_manager->GetDisplayForId(list[1]).bounds()); |
| 1124 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), | 1124 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), |
| 1125 display_manager->GetDisplayForId(list[2]).bounds()); | 1125 display_manager->GetDisplayForId(list[2]).bounds()); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 } // namespace chromeos | 1128 } // namespace chromeos |
| OLD | NEW |