Chromium Code Reviews| 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 |
|
oshima
2016/04/08 07:09:40
include?
| |
| 7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/display_util.h" | 9 #include "ash/display/display_util.h" |
| 10 #include "ash/host/root_window_transformer.h" | 10 #include "ash/host/root_window_transformer.h" |
| 11 #include "ash/magnifier/magnification_controller.h" | 11 #include "ash/magnifier/magnification_controller.h" |
| 12 #include "ash/screen_util.h" | 12 #include "ash/screen_util.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 float scroll_y_offset_ordinal_; | 108 float scroll_y_offset_ordinal_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); | 110 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 float GetStoredUIScale(int64_t id) { | 113 float GetStoredUIScale(int64_t id) { |
| 114 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id). | 114 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id). |
| 115 GetEffectiveUIScale(); | 115 GetEffectiveUIScale(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 scoped_ptr<RootWindowTransformer> | 118 std::unique_ptr<RootWindowTransformer> |
| 119 CreateCurrentRootWindowTransformerForMirroring() { | 119 CreateCurrentRootWindowTransformerForMirroring() { |
| 120 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 120 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 121 DCHECK(display_manager->IsInMirrorMode()); | 121 DCHECK(display_manager->IsInMirrorMode()); |
| 122 const DisplayInfo& mirror_display_info = | 122 const DisplayInfo& mirror_display_info = |
| 123 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); | 123 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); |
| 124 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 124 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
| 125 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); | 125 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); |
| 126 return scoped_ptr<RootWindowTransformer>( | 126 return std::unique_ptr<RootWindowTransformer>( |
| 127 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 127 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
| 128 mirror_display_info)); | 128 mirror_display_info)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 typedef test::AshTestBase RootWindowTransformersTest; | 133 typedef test::AshTestBase RootWindowTransformersTest; |
| 134 | 134 |
| 135 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 136 // TODO(scottmg): RootWindow doesn't get resized on Windows | 136 // TODO(scottmg): RootWindow doesn't get resized on Windows |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 402 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 403 } | 403 } |
| 404 | 404 |
| 405 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) { | 405 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) { |
| 406 if (!SupportsMultipleDisplays()) | 406 if (!SupportsMultipleDisplays()) |
| 407 return; | 407 return; |
| 408 test::MirrorWindowTestApi test_api; | 408 test::MirrorWindowTestApi test_api; |
| 409 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 409 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 410 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); | 410 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); |
| 411 UpdateDisplay("400x200,500x500"); | 411 UpdateDisplay("400x200,500x500"); |
| 412 scoped_ptr<RootWindowTransformer> transformer( | 412 std::unique_ptr<RootWindowTransformer> transformer( |
| 413 CreateCurrentRootWindowTransformerForMirroring()); | 413 CreateCurrentRootWindowTransformerForMirroring()); |
| 414 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 414 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
| 415 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 415 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
| 416 | 416 |
| 417 UpdateDisplay("200x400,500x500"); | 417 UpdateDisplay("200x400,500x500"); |
| 418 // The aspect ratio is flipped, so X margin is now 125. | 418 // The aspect ratio is flipped, so X margin is now 125. |
| 419 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 419 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
| 420 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 420 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace ash | 423 } // namespace ash |
| OLD | NEW |