Chromium Code Reviews| Index: ui/ozone/platform/headless/headless_window.cc |
| diff --git a/ui/ozone/platform/headless/headless_window.cc b/ui/ozone/platform/headless/headless_window.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..75f86a1aa56637aea4b354be8178e474f2a8707c |
| --- /dev/null |
| +++ b/ui/ozone/platform/headless/headless_window.cc |
| @@ -0,0 +1,77 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
Sami
2015/10/26 16:47:07
2015
altimin
2015/10/26 17:24:21
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/ozone/platform/headless/headless_window.h" |
| + |
| +#include <string> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/strings/string_number_conversions.h" |
| +#include "ui/events/platform/platform_event_source.h" |
| +#include "ui/ozone/platform/headless/headless_window_manager.h" |
| +#include "ui/platform_window/platform_window_delegate.h" |
| + |
| +namespace ui { |
| + |
| +HeadlessWindow::HeadlessWindow(PlatformWindowDelegate* delegate, |
| + HeadlessWindowManager* manager, |
| + const gfx::Rect& bounds) |
| + : delegate_(delegate), manager_(manager), bounds_(bounds) { |
| + widget_ = manager_->AddWindow(this); |
| + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); |
| +} |
| + |
| +HeadlessWindow::~HeadlessWindow() { |
| + manager_->RemoveWindow(widget_, this); |
| +} |
| + |
| +base::FilePath HeadlessWindow::path() { |
| + base::FilePath base_path = manager_->base_path(); |
| + if (base_path.empty() || base_path == base::FilePath("/dev/null")) |
| + return base_path; |
| + |
| + // Disambiguate multiple window output files with the window id. |
| + return base_path.Append(base::IntToString(widget_)); |
| +} |
| + |
| +gfx::Rect HeadlessWindow::GetBounds() { |
| + return bounds_; |
| +} |
| + |
| +void HeadlessWindow::SetBounds(const gfx::Rect& bounds) { |
| + bounds_ = bounds; |
| + delegate_->OnBoundsChanged(bounds); |
| +} |
| + |
| +void HeadlessWindow::SetTitle(const base::string16& title) {} |
| + |
| +void HeadlessWindow::Show() {} |
| + |
| +void HeadlessWindow::Hide() {} |
| + |
| +void HeadlessWindow::Close() {} |
| + |
| +void HeadlessWindow::SetCapture() {} |
| + |
| +void HeadlessWindow::ReleaseCapture() {} |
| + |
| +void HeadlessWindow::ToggleFullscreen() {} |
| + |
| +void HeadlessWindow::Maximize() {} |
| + |
| +void HeadlessWindow::Minimize() {} |
| + |
| +void HeadlessWindow::Restore() {} |
| + |
| +void HeadlessWindow::SetCursor(PlatformCursor cursor) {} |
| + |
| +void HeadlessWindow::MoveCursorTo(const gfx::Point& location) {} |
| + |
| +void HeadlessWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {} |
| + |
| +PlatformImeController* HeadlessWindow::GetPlatformImeController() { |
| + return nullptr; |
| +} |
| + |
| +} // namespace ui |