| 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" |
| 26 #include "ui/display/manager/display_info.h" |
| 27 #include "ui/display/manager/display_layout.h" | 27 #include "ui/display/manager/display_layout.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 |
| (...skipping 79 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 ui::DisplayInfo& 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 ui::DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
| 129 display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 129 display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
| 130 return std::unique_ptr<RootWindowTransformer>( | 130 return std::unique_ptr<RootWindowTransformer>( |
| 131 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 131 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
| 132 mirror_display_info)); | 132 mirror_display_info)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace | 135 } // namespace |
| 136 | 136 |
| 137 typedef test::AshTestBase RootWindowTransformersTest; | 137 typedef test::AshTestBase RootWindowTransformersTest; |
| 138 | 138 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 426 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
| 427 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 427 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
| 428 | 428 |
| 429 UpdateDisplay("200x400,500x500"); | 429 UpdateDisplay("200x400,500x500"); |
| 430 // The aspect ratio is flipped, so X margin is now 125. | 430 // The aspect ratio is flipped, so X margin is now 125. |
| 431 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 431 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
| 432 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 432 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace ash | 435 } // namespace ash |
| OLD | NEW |