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

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: 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
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/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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698