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

Side by Side Diff: ui/aura/test/event_generator.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First cut for review/trybots Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/test/event_generator.h" 5 #include "ui/aura/test/event_generator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace aura { 25 namespace aura {
26 namespace test { 26 namespace test {
27 namespace { 27 namespace {
28 28
29 void DummyCallback(ui::EventType, const gfx::Vector2dF&) { 29 void DummyCallback(ui::EventType, const gfx::Vector2dF&) {
30 } 30 }
31 31
32 class DefaultEventGeneratorDelegate : public EventGeneratorDelegate { 32 class DefaultEventGeneratorDelegate : public EventGeneratorDelegate {
33 public: 33 public:
34 explicit DefaultEventGeneratorDelegate(RootWindow* root_window) 34 explicit DefaultEventGeneratorDelegate(Window* root_window)
35 : root_window_(root_window) {} 35 : root_window_(root_window) {}
36 virtual ~DefaultEventGeneratorDelegate() {} 36 virtual ~DefaultEventGeneratorDelegate() {}
37 37
38 // EventGeneratorDelegate overrides: 38 // EventGeneratorDelegate overrides:
39 virtual RootWindow* GetRootWindowAt(const gfx::Point& point) const OVERRIDE { 39 virtual RootWindow* GetRootWindowAt(const gfx::Point& point) const OVERRIDE {
40 return root_window_; 40 return root_window_->GetDispatcher();
41 } 41 }
42 42
43 virtual client::ScreenPositionClient* GetScreenPositionClient( 43 virtual client::ScreenPositionClient* GetScreenPositionClient(
44 const aura::Window* window) const OVERRIDE { 44 const aura::Window* window) const OVERRIDE {
45 return NULL; 45 return NULL;
46 } 46 }
47 47
48 private: 48 private:
49 RootWindow* root_window_; 49 Window* root_window_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(DefaultEventGeneratorDelegate); 51 DISALLOW_COPY_AND_ASSIGN(DefaultEventGeneratorDelegate);
52 }; 52 };
53 53
54 class TestKeyEvent : public ui::KeyEvent { 54 class TestKeyEvent : public ui::KeyEvent {
55 public: 55 public:
56 TestKeyEvent(const base::NativeEvent& native_event, int flags, bool is_char) 56 TestKeyEvent(const base::NativeEvent& native_event, int flags, bool is_char)
57 : KeyEvent(native_event, is_char) { 57 : KeyEvent(native_event, is_char) {
58 set_flags(flags); 58 set_flags(flags);
59 } 59 }
60 }; 60 };
61 61
62 class TestTouchEvent : public ui::TouchEvent { 62 class TestTouchEvent : public ui::TouchEvent {
63 public: 63 public:
64 TestTouchEvent(ui::EventType type, 64 TestTouchEvent(ui::EventType type,
65 const gfx::Point& root_location, 65 const gfx::Point& root_location,
66 int flags) 66 int flags)
67 : TouchEvent(type, root_location, flags, 0, ui::EventTimeForNow(), 67 : TouchEvent(type, root_location, flags, 0, ui::EventTimeForNow(),
68 1.0f, 1.0f, 1.0f, 1.0f) { 68 1.0f, 1.0f, 1.0f, 1.0f) {
69 } 69 }
70 70
71 private: 71 private:
72 DISALLOW_COPY_AND_ASSIGN(TestTouchEvent); 72 DISALLOW_COPY_AND_ASSIGN(TestTouchEvent);
73 }; 73 };
74 74
75 const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON; 75 const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON;
76 76
77 } // namespace 77 } // namespace
78 78
79 EventGenerator::EventGenerator(RootWindow* root_window) 79 EventGenerator::EventGenerator(Window* root_window)
80 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 80 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
81 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 81 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
82 flags_(0), 82 flags_(0),
83 grab_(false), 83 grab_(false),
84 async_(false) { 84 async_(false) {
85 } 85 }
86 86
87 EventGenerator::EventGenerator(RootWindow* root_window, const gfx::Point& point) 87 EventGenerator::EventGenerator(Window* root_window, const gfx::Point& point)
88 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 88 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
89 current_location_(point), 89 current_location_(point),
90 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 90 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
91 flags_(0), 91 flags_(0),
92 grab_(false), 92 grab_(false),
93 async_(false) { 93 async_(false) {
94 } 94 }
95 95
96 EventGenerator::EventGenerator(RootWindow* root_window, Window* window) 96 EventGenerator::EventGenerator(Window* root_window, Window* window)
97 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 97 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
98 current_location_(CenterOfWindow(window)), 98 current_location_(CenterOfWindow(window)),
99 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 99 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
100 flags_(0), 100 flags_(0),
101 grab_(false), 101 grab_(false),
102 async_(false) { 102 async_(false) {
103 } 103 }
104 104
105 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate) 105 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate)
106 : delegate_(delegate), 106 : delegate_(delegate),
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 base::MessageLoopProxy::current()->PostTask( 566 base::MessageLoopProxy::current()->PostTask(
567 FROM_HERE, 567 FROM_HERE,
568 base::Bind(&EventGenerator::DispatchNextPendingEvent, 568 base::Bind(&EventGenerator::DispatchNextPendingEvent,
569 base::Unretained(this))); 569 base::Unretained(this)));
570 } 570 }
571 } 571 }
572 572
573 573
574 } // namespace test 574 } // namespace test
575 } // namespace aura 575 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698