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

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: rebase 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
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura/test/ui_controls_factory_aurawin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 }
(...skipping 10 matching lines...) Expand all
70 } 70 }
71 71
72 private: 72 private:
73 DISALLOW_COPY_AND_ASSIGN(TestTouchEvent); 73 DISALLOW_COPY_AND_ASSIGN(TestTouchEvent);
74 }; 74 };
75 75
76 const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON; 76 const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON;
77 77
78 } // namespace 78 } // namespace
79 79
80 EventGenerator::EventGenerator(RootWindow* root_window) 80 EventGenerator::EventGenerator(Window* root_window)
81 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 81 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
82 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 82 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
83 flags_(0), 83 flags_(0),
84 grab_(false), 84 grab_(false),
85 async_(false) { 85 async_(false) {
86 } 86 }
87 87
88 EventGenerator::EventGenerator(RootWindow* root_window, const gfx::Point& point) 88 EventGenerator::EventGenerator(Window* root_window, const gfx::Point& point)
89 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 89 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
90 current_location_(point), 90 current_location_(point),
91 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 91 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
92 flags_(0), 92 flags_(0),
93 grab_(false), 93 grab_(false),
94 async_(false) { 94 async_(false) {
95 } 95 }
96 96
97 EventGenerator::EventGenerator(RootWindow* root_window, Window* window) 97 EventGenerator::EventGenerator(Window* root_window, Window* window)
98 : delegate_(new DefaultEventGeneratorDelegate(root_window)), 98 : delegate_(new DefaultEventGeneratorDelegate(root_window)),
99 current_location_(CenterOfWindow(window)), 99 current_location_(CenterOfWindow(window)),
100 current_root_window_(delegate_->GetRootWindowAt(current_location_)), 100 current_root_window_(delegate_->GetRootWindowAt(current_location_)),
101 flags_(0), 101 flags_(0),
102 grab_(false), 102 grab_(false),
103 async_(false) { 103 async_(false) {
104 } 104 }
105 105
106 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate) 106 EventGenerator::EventGenerator(EventGeneratorDelegate* delegate)
107 : delegate_(delegate), 107 : delegate_(delegate),
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 base::MessageLoopProxy::current()->PostTask( 615 base::MessageLoopProxy::current()->PostTask(
616 FROM_HERE, 616 FROM_HERE,
617 base::Bind(&EventGenerator::DispatchNextPendingEvent, 617 base::Bind(&EventGenerator::DispatchNextPendingEvent,
618 base::Unretained(this))); 618 base::Unretained(this)));
619 } 619 }
620 } 620 }
621 621
622 622
623 } // namespace test 623 } // namespace test
624 } // namespace aura 624 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura/test/ui_controls_factory_aurawin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698