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 "ash/display/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "ui/aura/aura_switches.h" | 16 #include "ui/aura/aura_switches.h" |
17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/aura/root_window_host.h" | 19 #include "ui/aura/root_window_host.h" |
20 #include "ui/aura/window_property.h" | 20 #include "ui/aura/window_property.h" |
21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 24 #include "ui/gfx/size_conversions.h" |
24 | 25 |
25 #if defined(USE_X11) | 26 #if defined(USE_X11) |
26 #include "ui/base/x/x11_util.h" | 27 #include "ui/base/x/x11_util.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
30 #include "base/chromeos/chromeos_version.h" | 31 #include "base/chromeos/chromeos_version.h" |
31 #include "chromeos/display/output_configurator.h" | 32 #include "chromeos/display/output_configurator.h" |
32 #endif | 33 #endif |
33 | 34 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 400 |
400 void MultiDisplayManager::ScaleDisplayImpl() { | 401 void MultiDisplayManager::ScaleDisplayImpl() { |
401 DCHECK(!displays_.empty()); | 402 DCHECK(!displays_.empty()); |
402 std::vector<gfx::Display> new_displays; | 403 std::vector<gfx::Display> new_displays; |
403 for (DisplayList::const_iterator iter = displays_.begin(); | 404 for (DisplayList::const_iterator iter = displays_.begin(); |
404 iter != displays_.end(); ++iter) { | 405 iter != displays_.end(); ++iter) { |
405 gfx::Display display = *iter; | 406 gfx::Display display = *iter; |
406 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; | 407 float factor = display.device_scale_factor() == 1.0f ? 2.0f : 1.0f; |
407 display.SetScaleAndBounds( | 408 display.SetScaleAndBounds( |
408 factor, gfx::Rect(display.bounds_in_pixel().origin(), | 409 factor, gfx::Rect(display.bounds_in_pixel().origin(), |
409 display.size().Scale(factor))); | 410 gfx::ToFlooredSize(display.size().Scale(factor)))); |
410 new_displays.push_back(display); | 411 new_displays.push_back(display); |
411 } | 412 } |
412 OnNativeDisplaysChanged(new_displays); | 413 OnNativeDisplaysChanged(new_displays); |
413 } | 414 } |
414 | 415 |
415 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( | 416 gfx::Display& MultiDisplayManager::FindDisplayForRootWindow( |
416 const aura::RootWindow* root_window) { | 417 const aura::RootWindow* root_window) { |
417 int64 id = root_window->GetProperty(kDisplayIdKey); | 418 int64 id = root_window->GetProperty(kDisplayIdKey); |
418 // if id is |kInvaildDisplayID|, it's being deleted. | 419 // if id is |kInvaildDisplayID|, it's being deleted. |
419 DCHECK(id != gfx::Display::kInvalidDisplayID); | 420 DCHECK(id != gfx::Display::kInvalidDisplayID); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 DisplayList::iterator iter_to_update = to_update->begin(); | 452 DisplayList::iterator iter_to_update = to_update->begin(); |
452 DisplayList::const_iterator iter = displays_.begin(); | 453 DisplayList::const_iterator iter = displays_.begin(); |
453 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 454 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
454 ++iter, ++iter_to_update) { | 455 ++iter, ++iter_to_update) { |
455 (*iter_to_update).set_id((*iter).id()); | 456 (*iter_to_update).set_id((*iter).id()); |
456 } | 457 } |
457 } | 458 } |
458 | 459 |
459 } // namespace internal | 460 } // namespace internal |
460 } // namespace ash | 461 } // namespace ash |
OLD | NEW |