| 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_capture_client.h" | 7 #include "ui/aura/client/default_capture_client.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/test/input_method_glue.h" | 9 #include "ui/aura/test/input_method_glue.h" |
| 10 #include "ui/aura/test/test_focus_client.h" | 10 #include "ui/aura/test/test_focus_client.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #include "ui/wm/core/compound_event_filter.h" | 12 #include "ui/wm/core/compound_event_filter.h" |
| 13 #include "ui/wm/core/default_activation_client.h" | 13 #include "ui/wm/core/default_activation_client.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 ui::ContextFactory* context_factory) { | 18 ui::ContextFactory* context_factory) { |
| 19 aura::Env::GetInstance()->set_context_factory(context_factory); | 19 aura::Env::GetInstance()->set_context_factory(context_factory); |
| 20 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); | 20 |
| 21 host_->InitHost(); | 21 test_screen_.reset(aura::TestScreen::Create(default_window_size)); |
| 22 input_method_glue_.reset(new aura::InputMethodGlue(host_.get())); | 22 display::Screen::SetScreenInstance(test_screen_.get()); |
| 23 aura::client::SetWindowTreeClient(host_->window(), this); | 23 test_screen_->CreateHostForPrimaryDisplay(); |
| 24 input_method_glue_.reset(new aura::InputMethodGlue(host())); |
| 25 aura::client::SetWindowTreeClient(host()->window(), this); |
| 24 | 26 |
| 25 focus_client_.reset(new aura::test::TestFocusClient); | 27 focus_client_.reset(new aura::test::TestFocusClient); |
| 26 aura::client::SetFocusClient(host_->window(), focus_client_.get()); | 28 aura::client::SetFocusClient(host()->window(), focus_client_.get()); |
| 27 | 29 |
| 28 root_window_event_filter_.reset(new wm::CompoundEventFilter); | 30 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
| 29 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); | 31 host()->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
| 30 | 32 |
| 31 new wm::DefaultActivationClient(host_->window()); | 33 new wm::DefaultActivationClient(host()->window()); |
| 32 | 34 |
| 33 capture_client_.reset( | 35 capture_client_.reset( |
| 34 new aura::client::DefaultCaptureClient(host_->window())); | 36 new aura::client::DefaultCaptureClient(host()->window())); |
| 35 } | 37 } |
| 36 | 38 |
| 37 WMTestHelper::~WMTestHelper() { | 39 WMTestHelper::~WMTestHelper() { |
| 38 } | 40 } |
| 39 | 41 |
| 40 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, | 42 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, |
| 41 aura::Window* window, | 43 aura::Window* window, |
| 42 const gfx::Rect& bounds) { | 44 const gfx::Rect& bounds) { |
| 43 return host_->window(); | 45 return host()->window(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 } // namespace wm | 48 } // namespace wm |
| OLD | NEW |