Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: ui/ozone/platform/test/test_window.cc

Issue 377973005: ozone: test: Convert to PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add dcheck Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/test/test_window.h ('k') | ui/ozone/platform/test/test_window_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/events/platform/platform_event_source.h"
12 #include "ui/ozone/platform/test/test_window_manager.h"
13 #include "ui/platform_window/platform_window_delegate.h"
14
15 namespace ui {
16
17 TestWindow::TestWindow(PlatformWindowDelegate* delegate,
18 TestWindowManager* manager,
19 const gfx::Rect& bounds)
20 : delegate_(delegate), manager_(manager), bounds_(bounds) {
21 widget_ = manager_->AddWindow(this);
22 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
23 delegate_->OnAcceleratedWidgetAvailable(widget_);
24 }
25
26 TestWindow::~TestWindow() {
27 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
28 manager_->RemoveWindow(widget_, this);
29 }
30
31 base::FilePath TestWindow::path() {
32 base::FilePath base_path = manager_->base_path();
33
34 if (base_path == base::FilePath("/dev/null"))
35 return base_path;
36
37 // Disambiguate multiple window output files with the window id.
38 return base_path.Append(base::IntToString(widget_));
39 }
40
41 gfx::Rect TestWindow::GetBounds() {
42 return bounds_;
43 }
44
45 void TestWindow::SetBounds(const gfx::Rect& bounds) {
46 bounds_ = bounds;
47 delegate_->OnBoundsChanged(bounds);
48 }
49
50 void TestWindow::Show() {
51 }
52
53 void TestWindow::Hide() {
54 }
55
56 void TestWindow::Close() {
57 }
58
59 void TestWindow::SetCapture() {
60 }
61
62 void TestWindow::ReleaseCapture() {
63 }
64
65 void TestWindow::ToggleFullscreen() {
66 }
67
68 void TestWindow::Maximize() {
69 }
70
71 void TestWindow::Minimize() {
72 }
73
74 void TestWindow::Restore() {
75 }
76
77 bool TestWindow::CanDispatchEvent(const ui::PlatformEvent& ne) {
78 return true;
79 }
80
81 uint32_t TestWindow::DispatchEvent(const ui::PlatformEvent& ne) {
82 ui::Event* event = static_cast<ui::Event*>(ne);
83 delegate_->DispatchEvent(event);
84 return ui::POST_DISPATCH_STOP_PROPAGATION;
85 }
86
87 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/test/test_window.h ('k') | ui/ozone/platform/test/test_window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698