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

Side by Side Diff: ui/wm/test/wm_test_helper.cc

Issue 1403293003: Introduce AndroidFocusRules and NativeWidgetAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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/test_focus_client.h"
10 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
11 #include "ui/wm/core/compound_event_filter.h" 10 #include "ui/wm/core/compound_event_filter.h"
12 #include "ui/wm/core/default_activation_client.h" 11 #include "ui/wm/core/default_activation_client.h"
13 12
13 #if defined(OS_ANDROID)
14 #include "ui/wm/android/android_focus_rules.h"
15 #include "ui/wm/core/base_focus_rules.h"
16 #include "ui/wm/core/focus_controller.h"
17 #else
18 #include "ui/aura/test/test_focus_client.h"
19 #endif
20
14 namespace wm { 21 namespace wm {
15 22
16 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, 23 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size,
17 ui::ContextFactory* context_factory) { 24 ui::ContextFactory* context_factory) {
18 aura::Env::CreateInstance(true); 25 aura::Env::CreateInstance(true);
19 aura::Env::GetInstance()->set_context_factory(context_factory); 26 aura::Env::GetInstance()->set_context_factory(context_factory);
20 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); 27 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size)));
21 host_->InitHost(); 28 host_->InitHost();
22 aura::client::SetWindowTreeClient(host_->window(), this); 29 aura::client::SetWindowTreeClient(host_->window(), this);
23 30
31 #if defined(OS_ANDROID)
32 AndroidFocusRules* focus_rules = new AndroidFocusRules();
33 focus_client_.reset(new FocusController(focus_rules));
34 #else
24 focus_client_.reset(new aura::test::TestFocusClient); 35 focus_client_.reset(new aura::test::TestFocusClient);
36 #endif
sadrul 2015/10/19 15:36:11 Is there a reason to want to use the FocusControll
bshe 2015/11/03 19:40:39 My understanding is that we might use this test he
25 aura::client::SetFocusClient(host_->window(), focus_client_.get()); 37 aura::client::SetFocusClient(host_->window(), focus_client_.get());
26 38
27 root_window_event_filter_.reset(new wm::CompoundEventFilter); 39 root_window_event_filter_.reset(new wm::CompoundEventFilter);
28 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); 40 host_->window()->AddPreTargetHandler(root_window_event_filter_.get());
29 41
30 new wm::DefaultActivationClient(host_->window()); 42 new wm::DefaultActivationClient(host_->window());
31 43
32 capture_client_.reset( 44 capture_client_.reset(
33 new aura::client::DefaultCaptureClient(host_->window())); 45 new aura::client::DefaultCaptureClient(host_->window()));
34 } 46 }
35 47
36 WMTestHelper::~WMTestHelper() { 48 WMTestHelper::~WMTestHelper() {
37 } 49 }
38 50
39 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, 51 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context,
40 aura::Window* window, 52 aura::Window* window,
41 const gfx::Rect& bounds) { 53 const gfx::Rect& bounds) {
42 return host_->window(); 54 return host_->window();
43 } 55 }
44 56
45 } // namespace wm 57 } // namespace wm
OLDNEW
« ui/wm/android/android_focus_rules.cc ('K') | « ui/wm/android/android_focus_rules.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698