OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/test/wm_test_helper.h" | 5 #include "ui/wm/test/wm_test_helper.h" |
6 | 6 |
| 7 #include "ui/aura/client/default_activation_client.h" |
7 #include "ui/aura/client/default_capture_client.h" | 8 #include "ui/aura/client/default_capture_client.h" |
8 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
9 #include "ui/aura/test/test_focus_client.h" | 10 #include "ui/aura/test/test_focus_client.h" |
10 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
11 #include "ui/wm/core/compound_event_filter.h" | 12 #include "ui/wm/core/compound_event_filter.h" |
12 #include "ui/wm/core/default_activation_client.h" | |
13 #include "ui/wm/core/input_method_event_filter.h" | 13 #include "ui/wm/core/input_method_event_filter.h" |
14 | 14 |
15 namespace wm { | 15 namespace wm { |
16 | 16 |
17 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) { | 17 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) { |
18 aura::Env::CreateInstance(); | 18 aura::Env::CreateInstance(); |
19 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); | 19 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); |
20 host_->InitHost(); | 20 host_->InitHost(); |
21 aura::client::SetWindowTreeClient(host_->window(), this); | 21 aura::client::SetWindowTreeClient(host_->window(), this); |
22 | 22 |
23 focus_client_.reset(new aura::test::TestFocusClient); | 23 focus_client_.reset(new aura::test::TestFocusClient); |
24 aura::client::SetFocusClient(host_->window(), focus_client_.get()); | 24 aura::client::SetFocusClient(host_->window(), focus_client_.get()); |
25 | 25 |
26 root_window_event_filter_.reset(new wm::CompoundEventFilter); | 26 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
27 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); | 27 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
28 | 28 |
29 input_method_filter_.reset(new wm::InputMethodEventFilter( | 29 input_method_filter_.reset(new wm::InputMethodEventFilter( |
30 host_->GetAcceleratedWidget())); | 30 host_->GetAcceleratedWidget())); |
31 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); | 31 input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); |
32 root_window_event_filter_->AddHandler(input_method_filter_.get()); | 32 root_window_event_filter_->AddHandler(input_method_filter_.get()); |
33 | 33 |
34 new wm::DefaultActivationClient(host_->window()); | 34 activation_client_.reset( |
| 35 new aura::client::DefaultActivationClient(host_->window())); |
35 | 36 |
36 capture_client_.reset( | 37 capture_client_.reset( |
37 new aura::client::DefaultCaptureClient(host_->window())); | 38 new aura::client::DefaultCaptureClient(host_->window())); |
38 } | 39 } |
39 | 40 |
40 WMTestHelper::~WMTestHelper() { | 41 WMTestHelper::~WMTestHelper() { |
41 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | 42 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); |
42 } | 43 } |
43 | 44 |
44 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, | 45 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, |
45 aura::Window* window, | 46 aura::Window* window, |
46 const gfx::Rect& bounds) { | 47 const gfx::Rect& bounds) { |
47 return host_->window(); | 48 return host_->window(); |
48 } | 49 } |
49 | 50 |
50 } // namespace wm | 51 } // namespace wm |
OLD | NEW |