OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/aura/test/mus/test_window_tree_client_setup.h" | 5 #include "ui/aura/test/mus/test_window_tree_client_setup.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ui/aura/mus/window_tree_client.h" | 8 #include "ui/aura/mus/window_tree_client.h" |
9 #include "ui/aura/test/mus/test_window_manager_client.h" | |
9 #include "ui/aura/test/mus/test_window_tree.h" | 10 #include "ui/aura/test/mus/test_window_tree.h" |
10 #include "ui/aura/test/mus/window_tree_client_private.h" | 11 #include "ui/aura/test/mus/window_tree_client_private.h" |
11 #include "ui/display/display.h" | 12 #include "ui/display/display.h" |
12 | 13 |
13 namespace aura { | 14 namespace aura { |
14 | 15 |
15 TestWindowTreeClientSetup::TestWindowTreeClientSetup() {} | 16 TestWindowTreeClientSetup::TestWindowTreeClientSetup() {} |
16 | 17 |
17 TestWindowTreeClientSetup::~TestWindowTreeClientSetup() {} | 18 TestWindowTreeClientSetup::~TestWindowTreeClientSetup() {} |
18 | 19 |
19 void TestWindowTreeClientSetup::Init( | 20 void TestWindowTreeClientSetup::Init( |
20 WindowTreeClientDelegate* window_tree_delegate) { | 21 WindowTreeClientDelegate* window_tree_delegate) { |
21 CommonInit(window_tree_delegate, nullptr); | 22 CommonInit(window_tree_delegate, nullptr); |
22 WindowTreeClientPrivate(window_tree_client_.get()) | 23 WindowTreeClientPrivate(window_tree_client_.get()) |
23 .OnEmbed(window_tree_.get()); | 24 .OnEmbed(window_tree_.get()); |
24 } | 25 } |
25 | 26 |
26 void TestWindowTreeClientSetup::InitForWindowManager( | 27 void TestWindowTreeClientSetup::InitForWindowManager( |
27 WindowTreeClientDelegate* window_tree_delegate, | 28 WindowTreeClientDelegate* window_tree_delegate, |
28 WindowManagerDelegate* window_manager_delegate) { | 29 WindowManagerDelegate* window_manager_delegate) { |
30 test_window_manager_client_ = base::MakeUnique<TestWindowManagerClient>(); | |
29 CommonInit(window_tree_delegate, window_manager_delegate); | 31 CommonInit(window_tree_delegate, window_manager_delegate); |
30 WindowTreeClientPrivate(window_tree_client_.get()) | 32 WindowTreeClientPrivate wtc_private(window_tree_client_.get()); |
msw
2017/04/26 23:01:09
optional nit: avoid acronyms
sky
2017/04/26 23:30:28
Ya, I thought the name was rather long and went wi
| |
31 .SetTreeAndClientId(window_tree_.get(), 1); | 33 wtc_private.SetTreeAndClientId(window_tree_.get(), 1); |
34 wtc_private.SetWindowManagerClient(test_window_manager_client_.get()); | |
32 } | 35 } |
33 | 36 |
34 std::unique_ptr<WindowTreeClient> | 37 std::unique_ptr<WindowTreeClient> |
35 TestWindowTreeClientSetup::OwnWindowTreeClient() { | 38 TestWindowTreeClientSetup::OwnWindowTreeClient() { |
36 DCHECK(window_tree_client_); | 39 DCHECK(window_tree_client_); |
37 return std::move(window_tree_client_); | 40 return std::move(window_tree_client_); |
38 } | 41 } |
39 | 42 |
40 WindowTreeClient* TestWindowTreeClientSetup::window_tree_client() { | 43 WindowTreeClient* TestWindowTreeClientSetup::window_tree_client() { |
41 return window_tree_client_.get(); | 44 return window_tree_client_.get(); |
42 } | 45 } |
43 | 46 |
44 void TestWindowTreeClientSetup::CommonInit( | 47 void TestWindowTreeClientSetup::CommonInit( |
45 WindowTreeClientDelegate* window_tree_delegate, | 48 WindowTreeClientDelegate* window_tree_delegate, |
46 WindowManagerDelegate* window_manager_delegate) { | 49 WindowManagerDelegate* window_manager_delegate) { |
47 window_tree_.reset(new TestWindowTree); | 50 window_tree_.reset(new TestWindowTree); |
48 window_tree_client_ = base::MakeUnique<WindowTreeClient>( | 51 window_tree_client_ = base::MakeUnique<WindowTreeClient>( |
49 nullptr, window_tree_delegate, window_manager_delegate); | 52 nullptr, window_tree_delegate, window_manager_delegate); |
50 window_tree_->set_client(window_tree_client_.get()); | 53 window_tree_->set_client(window_tree_client_.get()); |
51 } | 54 } |
52 | 55 |
53 } // namespace aura | 56 } // namespace aura |
OLD | NEW |