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

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

Issue 808333004: virtual/override specifier cleanup in ui/ (mostly Ozone code). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 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
« no previous file with comments | « no previous file | ui/aura/window_tree_host_ozone.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "ui/aura/client/screen_position_client.h" 7 #include "ui/aura/client/screen_position_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/test/aura_test_utils.h" 9 #include "ui/aura/test/aura_test_utils.h"
10 #include "ui/aura/test/ui_controls_factory_aura.h" 10 #include "ui/aura/test/ui_controls_factory_aura.h"
11 #include "ui/aura/window_tree_host.h" 11 #include "ui/aura/window_tree_host.h"
12 #include "ui/base/test/ui_controls_aura.h" 12 #include "ui/base/test/ui_controls_aura.h"
13 #include "ui/events/test/events_test_utils.h" 13 #include "ui/events/test/events_test_utils.h"
14 14
15 namespace aura { 15 namespace aura {
16 namespace test { 16 namespace test {
17 namespace { 17 namespace {
18 18
19 class UIControlsOzone : public ui_controls::UIControlsAura { 19 class UIControlsOzone : public ui_controls::UIControlsAura {
20 public: 20 public:
21 UIControlsOzone(WindowTreeHost* host) : host_(host) {} 21 UIControlsOzone(WindowTreeHost* host) : host_(host) {}
22 22
23 virtual bool SendKeyPress(gfx::NativeWindow window, 23 bool SendKeyPress(gfx::NativeWindow window,
24 ui::KeyboardCode key, 24 ui::KeyboardCode key,
25 bool control, 25 bool control,
26 bool shift, 26 bool shift,
27 bool alt, 27 bool alt,
28 bool command) override { 28 bool command) override {
29 return SendKeyPressNotifyWhenDone( 29 return SendKeyPressNotifyWhenDone(
30 window, key, control, shift, alt, command, base::Closure()); 30 window, key, control, shift, alt, command, base::Closure());
31 } 31 }
32 virtual bool SendKeyPressNotifyWhenDone( 32 bool SendKeyPressNotifyWhenDone(
33 gfx::NativeWindow window, 33 gfx::NativeWindow window,
34 ui::KeyboardCode key, 34 ui::KeyboardCode key,
35 bool control, 35 bool control,
36 bool shift, 36 bool shift,
37 bool alt, 37 bool alt,
38 bool command, 38 bool command,
39 const base::Closure& closure) override { 39 const base::Closure& closure) override {
40 int flags = button_down_mask_; 40 int flags = button_down_mask_;
41 41
42 if (control) { 42 if (control) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 if (command) { 80 if (command) {
81 flags &= ~ui::EF_COMMAND_DOWN; 81 flags &= ~ui::EF_COMMAND_DOWN;
82 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_LWIN, flags); 82 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_LWIN, flags);
83 } 83 }
84 84
85 RunClosureAfterAllPendingUIEvents(closure); 85 RunClosureAfterAllPendingUIEvents(closure);
86 return true; 86 return true;
87 } 87 }
88 88
89 virtual bool SendMouseMove(long screen_x, long screen_y) override { 89 bool SendMouseMove(long screen_x, long screen_y) override {
90 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); 90 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure());
91 } 91 }
92 virtual bool SendMouseMoveNotifyWhenDone( 92 bool SendMouseMoveNotifyWhenDone(
93 long screen_x, 93 long screen_x,
94 long screen_y, 94 long screen_y,
95 const base::Closure& closure) override { 95 const base::Closure& closure) override {
96 gfx::Point root_location(screen_x, screen_y); 96 gfx::Point root_location(screen_x, screen_y);
97 aura::client::ScreenPositionClient* screen_position_client = 97 aura::client::ScreenPositionClient* screen_position_client =
98 aura::client::GetScreenPositionClient(host_->window()); 98 aura::client::GetScreenPositionClient(host_->window());
99 if (screen_position_client) { 99 if (screen_position_client) {
100 screen_position_client->ConvertPointFromScreen(host_->window(), 100 screen_position_client->ConvertPointFromScreen(host_->window(),
101 &root_location); 101 &root_location);
102 } 102 }
103 103
104 gfx::Point host_location = root_location; 104 gfx::Point host_location = root_location;
105 host_->ConvertPointToHost(&host_location); 105 host_->ConvertPointToHost(&host_location);
106 106
107 ui::EventType event_type; 107 ui::EventType event_type;
108 108
109 if (button_down_mask_) 109 if (button_down_mask_)
110 event_type = ui::ET_MOUSE_DRAGGED; 110 event_type = ui::ET_MOUSE_DRAGGED;
111 else 111 else
112 event_type = ui::ET_MOUSE_MOVED; 112 event_type = ui::ET_MOUSE_MOVED;
113 113
114 PostMouseEvent(event_type, host_location, 0, 0); 114 PostMouseEvent(event_type, host_location, 0, 0);
115 115
116 RunClosureAfterAllPendingUIEvents(closure); 116 RunClosureAfterAllPendingUIEvents(closure);
117 return true; 117 return true;
118 } 118 }
119 virtual bool SendMouseEvents(ui_controls::MouseButton type, 119 bool SendMouseEvents(ui_controls::MouseButton type, int state) override {
120 int state) override {
121 return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); 120 return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
122 } 121 }
123 virtual bool SendMouseEventsNotifyWhenDone( 122 bool SendMouseEventsNotifyWhenDone(
124 ui_controls::MouseButton type, 123 ui_controls::MouseButton type,
125 int state, 124 int state,
126 const base::Closure& closure) override { 125 const base::Closure& closure) override {
127 gfx::Point root_location = aura::Env::GetInstance()->last_mouse_location(); 126 gfx::Point root_location = aura::Env::GetInstance()->last_mouse_location();
128 aura::client::ScreenPositionClient* screen_position_client = 127 aura::client::ScreenPositionClient* screen_position_client =
129 aura::client::GetScreenPositionClient(host_->window()); 128 aura::client::GetScreenPositionClient(host_->window());
130 if (screen_position_client) { 129 if (screen_position_client) {
131 screen_position_client->ConvertPointFromScreen(host_->window(), 130 screen_position_client->ConvertPointFromScreen(host_->window(),
132 &root_location); 131 &root_location);
133 } 132 }
(...skipping 25 matching lines...) Expand all
159 } 158 }
160 if (state & ui_controls::UP) { 159 if (state & ui_controls::UP) {
161 button_down_mask_ &= ~flag; 160 button_down_mask_ &= ~flag;
162 PostMouseEvent(ui::ET_MOUSE_RELEASED, host_location, 161 PostMouseEvent(ui::ET_MOUSE_RELEASED, host_location,
163 button_down_mask_ | flag, flag); 162 button_down_mask_ | flag, flag);
164 } 163 }
165 164
166 RunClosureAfterAllPendingUIEvents(closure); 165 RunClosureAfterAllPendingUIEvents(closure);
167 return true; 166 return true;
168 } 167 }
169 virtual bool SendMouseClick(ui_controls::MouseButton type) override { 168 bool SendMouseClick(ui_controls::MouseButton type) override {
170 return SendMouseEvents(type, ui_controls::UP | ui_controls::DOWN); 169 return SendMouseEvents(type, ui_controls::UP | ui_controls::DOWN);
171 } 170 }
172 virtual void RunClosureAfterAllPendingUIEvents( 171 void RunClosureAfterAllPendingUIEvents(
173 const base::Closure& closure) override { 172 const base::Closure& closure) override {
174 if (!closure.is_null()) 173 if (!closure.is_null())
175 base::MessageLoop::current()->PostTask(FROM_HERE, closure); 174 base::MessageLoop::current()->PostTask(FROM_HERE, closure);
176 } 175 }
177 176
178 private: 177 private:
179 void SendEventToProcessor(ui::Event* event) { 178 void SendEventToProcessor(ui::Event* event) {
180 ui::EventSourceTestApi event_source_test(host_->GetEventSource()); 179 ui::EventSourceTestApi event_source_test(host_->GetEventSource());
181 ui::EventDispatchDetails details = 180 ui::EventDispatchDetails details =
182 event_source_test.SendEventToProcessor(event); 181 event_source_test.SendEventToProcessor(event);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 }; 235 };
237 236
238 } // namespace 237 } // namespace
239 238
240 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { 239 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
241 return new UIControlsOzone(host); 240 return new UIControlsOzone(host);
242 } 241 }
243 242
244 } // namespace test 243 } // namespace test
245 } // namespace aura 244 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window_tree_host_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698