OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/ozone/platform/test/test_window.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "ui/ozone/platform/test/test_window_manager.h" |
| 12 #include "ui/window/platform_window_delegate.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 TestWindow::TestWindow(PlatformWindowDelegate* delegate, |
| 17 TestWindowManager* manager, |
| 18 const gfx::Rect& bounds) |
| 19 : delegate_(delegate), manager_(manager), bounds_(bounds) { |
| 20 widget_ = manager_->AddWindow(this); |
| 21 } |
| 22 |
| 23 TestWindow::~TestWindow() { |
| 24 manager_->RemoveWindow(widget_, this); |
| 25 } |
| 26 |
| 27 base::FilePath TestWindow::path() { |
| 28 base::FilePath base_path = manager_->base_path(); |
| 29 |
| 30 if (base_path == base::FilePath("/dev/null")) |
| 31 return base_path; |
| 32 |
| 33 // Disambiguate multiple window output files with the window id. |
| 34 return base_path.Append(base::IntToString(GetAcceleratedWidget())); |
| 35 } |
| 36 |
| 37 gfx::Rect TestWindow::GetBounds() const { |
| 38 return bounds_; |
| 39 } |
| 40 |
| 41 gfx::AcceleratedWidget TestWindow::GetAcceleratedWidget() { |
| 42 return widget_; |
| 43 } |
| 44 |
| 45 void TestWindow::SetBounds(const gfx::Rect& bounds) { |
| 46 bounds_ = bounds; |
| 47 delegate_->OnBoundsChanged(bounds); |
| 48 } |
| 49 |
| 50 } // namespace ui |
OLD | NEW |