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

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

Issue 1469803006: NOT FOR REVIEW: Aura Android: Content Shell compiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_wthandroid
Patch Set: Temp Created 5 years 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
« no previous file with comments | « ui/wm/test/wm_test_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/run_loop.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/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/wm/core/compound_event_filter.h" 11 #include "ui/wm/core/compound_event_filter.h"
12 #include "ui/wm/core/default_activation_client.h" 12 #include "ui/wm/core/default_activation_client.h"
13 #include "ui/wm/core/default_screen_position_client.h"
14 #include "ui/wm/public/dispatcher_client.h"
15
16 #if defined(OS_ANDROID) && defined(USE_AURA)
17 //#include "ui/wm/android/android_focus_rules.h"
18 //#include "ui/wm/core/base_focus_rules.h"
19 //#include "ui/wm/core/focus_controller.h"
20 #else
21 #include "ui/aura/test/test_focus_client.h"
22 #endif
13 23
14 namespace wm { 24 namespace wm {
25 //namespace {
26 //class TestDispatcherClient : public aura::client::DispatcherClient {
27 // public:
28 // TestDispatcherClient() : dispatcher_(nullptr) {}
29 // ~TestDispatcherClient() override {}
30 //
31 // base::MessagePumpDispatcher* dispatcher() {
32 // return dispatcher_;
33 // }
34 //
35 // // aura::client::DispatcherClient:
36 // void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher,
37 // base::Closure* run_closure,
38 // base::Closure* quit_closure) override {
39 // scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
40 // *quit_closure = run_loop->QuitClosure();
41 // *run_closure = base::Bind(&TestDispatcherClient::RunNestedDispatcher,
42 // base::Unretained(this),
43 // base::Passed(&run_loop),
44 // dispatcher);
45 // }
46 //
47 // private:
48 // void RunNestedDispatcher(scoped_ptr<base::RunLoop> run_loop,
49 // base::MessagePumpDispatcher* dispatcher) {
50 // base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher _,
51 // dispatcher) ;
52 // base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
53 // base::MessageLoop::ScopedNestableTaskAllower allow(loop);
54 // run_loop->Run();
55 // }
56 //
57 // base::MessagePumpDispatcher* dispatcher_;
58 //
59 // DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient);
60 //};
61 //} // namespace
62
15 63
16 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, 64 WMTestHelper::WMTestHelper(const gfx::Size& default_window_size,
17 ui::ContextFactory* context_factory) { 65 ui::ContextFactory* context_factory) {
18 aura::Env::CreateInstance(true); 66 aura::Env::CreateInstance(true);
19 aura::Env::GetInstance()->set_context_factory(context_factory); 67 aura::Env::GetInstance()->set_context_factory(context_factory);
68 LOG(ERROR) << "auraclank: WMTestHelper ctor: context_factory="
69 << context_factory;
70
20 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); 71 host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size)));
72 LOG(ERROR) << "auraclank: Before InitHost";
21 host_->InitHost(); 73 host_->InitHost();
74 LOG(ERROR) << "auraclank: After InitHost";
75 // host_->Show();
22 aura::client::SetWindowTreeClient(host_->window(), this); 76 aura::client::SetWindowTreeClient(host_->window(), this);
23 77
78 // NativeWidgetAndroid creates its own FocusClient
79 #if !defined(OS_ANDROID)
24 focus_client_.reset(new aura::test::TestFocusClient); 80 focus_client_.reset(new aura::test::TestFocusClient);
25 aura::client::SetFocusClient(host_->window(), focus_client_.get()); 81 aura::client::SetFocusClient(host_->window(), focus_client_.get());
82 #endif
83
26 84
27 root_window_event_filter_.reset(new wm::CompoundEventFilter); 85 root_window_event_filter_.reset(new wm::CompoundEventFilter);
28 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); 86 host_->window()->AddPreTargetHandler(root_window_event_filter_.get());
29 87
30 new wm::DefaultActivationClient(host_->window()); 88 new wm::DefaultActivationClient(host_->window());
31 89
32 capture_client_.reset( 90
33 new aura::client::DefaultCaptureClient(host_->window())); 91 // capture_client_.reset(
92 // new aura::client::DefaultCaptureClient(host_->window()));
93 // screen_position_client_.reset(new DefaultScreenPositionClient);
94 // aura::client::SetScreenPositionClient(host_->window(),
95 // screen_position_client_.get());
96 // dispatcher_client_.reset(new TestDispatcherClient);
97 // aura::client::SetDispatcherClient(host_->window(),
98 // dispatcher_client_.get());
34 } 99 }
35 100
36 WMTestHelper::~WMTestHelper() { 101 WMTestHelper::~WMTestHelper() {
37 } 102 }
38 103
104 void WMTestHelper::Init() {
105 // LOG(ERROR) << "auraclank: Before InitHost";
106 // host_->InitHost();
107 // LOG(ERROR) << "auraclank: After InitHost";
108 //// host_->Show();
109 // aura::client::SetWindowTreeClient(host_->window(), this);
110 //
111 // // NativeWidgetAndroid creates its own FocusClient
112 //#if !defined(OS_ANDROID)
113 // focus_client_.reset(new aura::test::TestFocusClient);
114 // aura::client::SetFocusClient(host_->window(), focus_client_.get());
115 //#endif
116 //
117 //
118 // root_window_event_filter_.reset(new wm::CompoundEventFilter);
119 // host_->window()->AddPreTargetHandler(root_window_event_filter_.get());
120 //
121 // new wm::DefaultActivationClient(host_->window());
122 }
123
39 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, 124 aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context,
40 aura::Window* window, 125 aura::Window* window,
41 const gfx::Rect& bounds) { 126 const gfx::Rect& bounds) {
42 return host_->window(); 127 return host_->window();
43 } 128 }
44 129
45 } // namespace wm 130 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/test/wm_test_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698