OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/test/exo_test_helper.h" | 5 #include "components/exo/test/exo_test_helper.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/wm/window_positioner.h" | 8 #include "ash/wm/window_positioner.h" |
9 #include "ash/wm/window_positioning_utils.h" | 9 #include "ash/wm/window_positioning_utils.h" |
10 #include "ash/wm_window.h" | |
11 #include "components/exo/buffer.h" | 10 #include "components/exo/buffer.h" |
12 #include "components/exo/shell_surface.h" | 11 #include "components/exo/shell_surface.h" |
13 #include "components/exo/surface.h" | 12 #include "components/exo/surface.h" |
14 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 13 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
15 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
16 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
17 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
18 | 17 |
19 namespace exo { | 18 namespace exo { |
20 namespace test { | 19 namespace test { |
21 | 20 |
22 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
23 // ExoTestHelper, public: | 22 // ExoTestHelper, public: |
24 | 23 |
25 ExoTestWindow::ExoTestWindow(std::unique_ptr<gfx::GpuMemoryBuffer> gpu_buffer, | 24 ExoTestWindow::ExoTestWindow(std::unique_ptr<gfx::GpuMemoryBuffer> gpu_buffer, |
26 bool is_modal) { | 25 bool is_modal) { |
27 surface_.reset(new Surface()); | 26 surface_.reset(new Surface()); |
28 int container = is_modal ? ash::kShellWindowId_SystemModalContainer | 27 int container = is_modal ? ash::kShellWindowId_SystemModalContainer |
29 : ash::kShellWindowId_DefaultContainer; | 28 : ash::kShellWindowId_DefaultContainer; |
30 shell_surface_.reset(new ShellSurface(surface_.get(), nullptr, | 29 shell_surface_.reset(new ShellSurface(surface_.get(), nullptr, |
31 ShellSurface::BoundsMode::SHELL, | 30 ShellSurface::BoundsMode::SHELL, |
32 gfx::Point(), true, false, container)); | 31 gfx::Point(), true, false, container)); |
33 | 32 |
34 buffer_.reset(new Buffer(std::move(gpu_buffer))); | 33 buffer_.reset(new Buffer(std::move(gpu_buffer))); |
35 surface_->Attach(buffer_.get()); | 34 surface_->Attach(buffer_.get()); |
36 surface_->Commit(); | 35 surface_->Commit(); |
37 | 36 |
38 ash::wm::CenterWindow( | 37 ash::wm::CenterWindow(shell_surface_->GetWidget()->GetNativeWindow()); |
39 ash::WmWindow::Get(shell_surface_->GetWidget()->GetNativeWindow())); | |
40 } | 38 } |
41 | 39 |
42 ExoTestWindow::ExoTestWindow(ExoTestWindow&& other) { | 40 ExoTestWindow::ExoTestWindow(ExoTestWindow&& other) { |
43 surface_ = std::move(other.surface_); | 41 surface_ = std::move(other.surface_); |
44 buffer_ = std::move(other.buffer_); | 42 buffer_ = std::move(other.buffer_); |
45 shell_surface_ = std::move(other.shell_surface_); | 43 shell_surface_ = std::move(other.shell_surface_); |
46 } | 44 } |
47 | 45 |
48 ExoTestWindow::~ExoTestWindow() {} | 46 ExoTestWindow::~ExoTestWindow() {} |
49 | 47 |
(...skipping 22 matching lines...) Expand all Loading... |
72 | 70 |
73 ExoTestWindow ExoTestHelper::CreateWindow(int width, | 71 ExoTestWindow ExoTestHelper::CreateWindow(int width, |
74 int height, | 72 int height, |
75 bool is_modal) { | 73 bool is_modal) { |
76 return ExoTestWindow(CreateGpuMemoryBuffer(gfx::Size(width, height)), | 74 return ExoTestWindow(CreateGpuMemoryBuffer(gfx::Size(width, height)), |
77 is_modal); | 75 is_modal); |
78 } | 76 } |
79 | 77 |
80 } // namespace test | 78 } // namespace test |
81 } // namespace exo | 79 } // namespace exo |
OLD | NEW |