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/ui/webui/options/chromeos/display_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 return mode; | 151 return mode; |
152 } | 152 } |
153 | 153 |
154 // Used to select the actual mode. | 154 // Used to select the actual mode. |
155 mode = new display::ManagedDisplayMode( | 155 mode = new display::ManagedDisplayMode( |
156 size, refresh_rate, false /* interlaced */, false /* native */, ui_scale, | 156 size, refresh_rate, false /* interlaced */, false /* native */, ui_scale, |
157 device_scale_factor); | 157 device_scale_factor); |
158 return mode; | 158 return mode; |
159 } | 159 } |
160 | 160 |
161 base::DictionaryValue* ConvertDisplayModeToValue( | 161 std::unique_ptr<base::DictionaryValue> ConvertDisplayModeToValue( |
162 int64_t display_id, | 162 int64_t display_id, |
163 const scoped_refptr<display::ManagedDisplayMode>& mode) { | 163 const scoped_refptr<display::ManagedDisplayMode>& mode) { |
164 bool is_internal = display::Display::HasInternalDisplay() && | 164 bool is_internal = display::Display::HasInternalDisplay() && |
165 display::Display::InternalDisplayId() == display_id; | 165 display::Display::InternalDisplayId() == display_id; |
166 base::DictionaryValue* result = new base::DictionaryValue(); | 166 auto result = base::MakeUnique<base::DictionaryValue>(); |
167 gfx::Size size_dip = mode->GetSizeInDIP(is_internal); | 167 gfx::Size size_dip = mode->GetSizeInDIP(is_internal); |
168 result->SetInteger("width", size_dip.width()); | 168 result->SetInteger("width", size_dip.width()); |
169 result->SetInteger("height", size_dip.height()); | 169 result->SetInteger("height", size_dip.height()); |
170 result->SetInteger("originalWidth", mode->size().width()); | 170 result->SetInteger("originalWidth", mode->size().width()); |
171 result->SetInteger("originalHeight", mode->size().height()); | 171 result->SetInteger("originalHeight", mode->size().height()); |
172 result->SetDouble("deviceScaleFactor", mode->device_scale_factor()); | 172 result->SetDouble("deviceScaleFactor", mode->device_scale_factor()); |
173 result->SetDouble("scale", mode->ui_scale()); | 173 result->SetDouble("scale", mode->ui_scale()); |
174 result->SetDouble("refreshRate", mode->refresh_rate()); | 174 result->SetDouble("refreshRate", mode->refresh_rate()); |
175 result->SetBoolean("isBest", | 175 result->SetBoolean("isBest", |
176 is_internal ? (mode->ui_scale() == 1.0f) : mode->native()); | 176 is_internal ? (mode->ui_scale() == 1.0f) : mode->native()); |
177 result->SetBoolean("isNative", mode->native()); | 177 result->SetBoolean("isNative", mode->native()); |
178 result->SetBoolean( | 178 result->SetBoolean( |
179 "selected", | 179 "selected", |
180 mode->IsEquivalent( | 180 mode->IsEquivalent( |
181 GetDisplayManager()->GetActiveModeForDisplayId(display_id))); | 181 GetDisplayManager()->GetActiveModeForDisplayId(display_id))); |
182 return result; | 182 return result; |
183 } | 183 } |
184 | 184 |
185 base::DictionaryValue* ConvertBoundsToValue(const gfx::Rect& bounds) { | 185 base::DictionaryValue* ConvertBoundsToValue(const gfx::Rect& bounds) { |
186 base::DictionaryValue* result = new base::DictionaryValue(); | 186 base::DictionaryValue* result = new base::DictionaryValue(); |
dpapad
2016/10/13 18:36:02
How about this one?
dcheng
2016/10/13 19:41:07
Mostly it's about unblocking the removal of ListVa
| |
187 result->SetInteger("left", bounds.x()); | 187 result->SetInteger("left", bounds.x()); |
188 result->SetInteger("top", bounds.y()); | 188 result->SetInteger("top", bounds.y()); |
189 result->SetInteger("width", bounds.width()); | 189 result->SetInteger("width", bounds.width()); |
190 result->SetInteger("height", bounds.height()); | 190 result->SetInteger("height", bounds.height()); |
191 return result; | 191 return result; |
192 } | 192 } |
193 | 193 |
194 } // namespace | 194 } // namespace |
195 | 195 |
196 DisplayOptionsHandler::DisplayOptionsHandler() { | 196 DisplayOptionsHandler::DisplayOptionsHandler() { |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 bool enable = false; | 578 bool enable = false; |
579 if (!args->GetBoolean(0, &enable)) | 579 if (!args->GetBoolean(0, &enable)) |
580 NOTREACHED(); | 580 NOTREACHED(); |
581 | 581 |
582 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( | 582 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( |
583 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); | 583 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); |
584 } | 584 } |
585 | 585 |
586 } // namespace options | 586 } // namespace options |
587 } // namespace chromeos | 587 } // namespace chromeos |
OLD | NEW |