| 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 "base/memory/ptr_util.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/input_method_glue.h" | 10 #include "ui/aura/test/input_method_glue.h" |
| 10 #include "ui/aura/test/test_focus_client.h" | 11 #include "ui/aura/test/test_focus_client.h" |
| 11 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 12 #include "ui/wm/core/compound_event_filter.h" | 13 #include "ui/wm/core/compound_event_filter.h" |
| 13 #include "ui/wm/core/default_activation_client.h" | 14 #include "ui/wm/core/default_activation_client.h" |
| 15 #include "ui/wm/core/wm_state.h" |
| 14 | 16 |
| 15 namespace wm { | 17 namespace wm { |
| 16 | 18 |
| 17 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, | 19 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, |
| 18 ui::ContextFactory* context_factory) { | 20 ui::ContextFactory* context_factory) { |
| 21 wm_state_ = base::MakeUnique<WMState>(); |
| 19 aura::Env::GetInstance()->set_context_factory(context_factory); | 22 aura::Env::GetInstance()->set_context_factory(context_factory); |
| 20 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); | 23 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); |
| 21 host_->InitHost(); | 24 host_->InitHost(); |
| 22 input_method_glue_.reset(new aura::InputMethodGlue(host_.get())); | 25 input_method_glue_.reset(new aura::InputMethodGlue(host_.get())); |
| 23 aura::client::SetWindowParentingClient(host_->window(), this); | 26 aura::client::SetWindowParentingClient(host_->window(), this); |
| 24 | 27 |
| 25 focus_client_.reset(new aura::test::TestFocusClient); | 28 focus_client_.reset(new aura::test::TestFocusClient); |
| 26 aura::client::SetFocusClient(host_->window(), focus_client_.get()); | 29 aura::client::SetFocusClient(host_->window(), focus_client_.get()); |
| 27 | 30 |
| 28 root_window_event_filter_.reset(new wm::CompoundEventFilter); | 31 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
| 29 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); | 32 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
| 30 | 33 |
| 31 new wm::DefaultActivationClient(host_->window()); | 34 new wm::DefaultActivationClient(host_->window()); |
| 32 | 35 |
| 33 capture_client_.reset( | 36 capture_client_.reset( |
| 34 new aura::client::DefaultCaptureClient(host_->window())); | 37 new aura::client::DefaultCaptureClient(host_->window())); |
| 35 } | 38 } |
| 36 | 39 |
| 37 WMTestHelper::~WMTestHelper() { | 40 WMTestHelper::~WMTestHelper() { |
| 38 } | 41 } |
| 39 | 42 |
| 40 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, | 43 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, |
| 41 aura::Window* window, | 44 aura::Window* window, |
| 42 const gfx::Rect& bounds) { | 45 const gfx::Rect& bounds) { |
| 43 return host_->window(); | 46 return host_->window(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 } // namespace wm | 49 } // namespace wm |
| OLD | NEW |