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