OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/root_window_transformers.h" | 5 #include "ash/display/root_window_transformers.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/display/display_info.h" | |
10 #include "ash/common/shelf/shelf.h" | 9 #include "ash/common/shelf/shelf.h" |
11 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
12 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
13 #include "ash/display/display_util.h" | 12 #include "ash/display/display_util.h" |
14 #include "ash/host/root_window_transformer.h" | 13 #include "ash/host/root_window_transformer.h" |
15 #include "ash/magnifier/magnification_controller.h" | 14 #include "ash/magnifier/magnification_controller.h" |
16 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
17 #include "ash/shell.h" | 16 #include "ash/shell.h" |
18 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
19 #include "ash/test/cursor_manager_test_api.h" | 18 #include "ash/test/cursor_manager_test_api.h" |
20 #include "ash/test/display_manager_test_api.h" | 19 #include "ash/test/display_manager_test_api.h" |
21 #include "ash/test/mirror_window_test_api.h" | 20 #include "ash/test/mirror_window_test_api.h" |
22 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
23 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
24 #include "ui/aura/window_event_dispatcher.h" | 23 #include "ui/aura/window_event_dispatcher.h" |
25 #include "ui/aura/window_tracker.h" | 24 #include "ui/aura/window_tracker.h" |
26 #include "ui/display/display.h" | 25 #include "ui/display/display.h" |
27 #include "ui/display/manager/display_layout.h" | 26 #include "ui/display/manager/display_layout.h" |
| 27 #include "ui/display/manager/managed_display_info.h" |
28 #include "ui/display/screen.h" | 28 #include "ui/display/screen.h" |
29 #include "ui/events/event_handler.h" | 29 #include "ui/events/event_handler.h" |
30 #include "ui/events/test/event_generator.h" | 30 #include "ui/events/test/event_generator.h" |
31 #include "ui/gfx/geometry/rect_conversions.h" | 31 #include "ui/gfx/geometry/rect_conversions.h" |
32 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
33 | 33 |
34 namespace ash { | 34 namespace ash { |
35 namespace { | 35 namespace { |
36 | 36 |
37 const char kWallpaperView[] = "WallpaperView"; | 37 const char kWallpaperView[] = "WallpaperView"; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return Shell::GetInstance() | 116 return Shell::GetInstance() |
117 ->display_manager() | 117 ->display_manager() |
118 ->GetDisplayInfo(id) | 118 ->GetDisplayInfo(id) |
119 .GetEffectiveUIScale(); | 119 .GetEffectiveUIScale(); |
120 } | 120 } |
121 | 121 |
122 std::unique_ptr<RootWindowTransformer> | 122 std::unique_ptr<RootWindowTransformer> |
123 CreateCurrentRootWindowTransformerForMirroring() { | 123 CreateCurrentRootWindowTransformerForMirroring() { |
124 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 124 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
125 DCHECK(display_manager->IsInMirrorMode()); | 125 DCHECK(display_manager->IsInMirrorMode()); |
126 const DisplayInfo& mirror_display_info = | 126 const display::ManagedDisplayInfo& mirror_display_info = |
127 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); | 127 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); |
128 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 128 const display::ManagedDisplayInfo& source_display_info = |
129 display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 129 display_manager->GetDisplayInfo( |
| 130 display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
130 return std::unique_ptr<RootWindowTransformer>( | 131 return std::unique_ptr<RootWindowTransformer>( |
131 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 132 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
132 mirror_display_info)); | 133 mirror_display_info)); |
133 } | 134 } |
134 | 135 |
135 } // namespace | 136 } // namespace |
136 | 137 |
137 typedef test::AshTestBase RootWindowTransformersTest; | 138 typedef test::AshTestBase RootWindowTransformersTest; |
138 | 139 |
139 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 427 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
427 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 428 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
428 | 429 |
429 UpdateDisplay("200x400,500x500"); | 430 UpdateDisplay("200x400,500x500"); |
430 // The aspect ratio is flipped, so X margin is now 125. | 431 // The aspect ratio is flipped, so X margin is now 125. |
431 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 432 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
432 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 433 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
433 } | 434 } |
434 | 435 |
435 } // namespace ash | 436 } // namespace ash |
OLD | NEW |