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

Side by Side Diff: ui/aura/root_window.cc

Issue 23202016: Addressing sadruls comments from the previous CL https://codereview.chromium.org/22865036/ which was (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_unittest.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/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 event.type() == ui::ET_GESTURE_TAP_DOWN); 220 event.type() == ui::ET_GESTURE_TAP_DOWN);
221 // We allow for only one outstanding repostable event. This is used 221 // We allow for only one outstanding repostable event. This is used
222 // in exiting context menus. A dropped repost request is allowed. 222 // in exiting context menus. A dropped repost request is allowed.
223 if (event.type() == ui::ET_MOUSE_PRESSED) { 223 if (event.type() == ui::ET_MOUSE_PRESSED) {
224 held_repostable_event_.reset( 224 held_repostable_event_.reset(
225 new ui::MouseEvent( 225 new ui::MouseEvent(
226 static_cast<const ui::MouseEvent&>(event), 226 static_cast<const ui::MouseEvent&>(event),
227 static_cast<aura::Window*>(event.target()), 227 static_cast<aura::Window*>(event.target()),
228 static_cast<aura::Window*>(this))); 228 static_cast<aura::Window*>(this)));
229 } else { 229 } else {
230 const ui::GestureEvent* gesture_event = 230 held_repostable_event_.reset(
231 static_cast<const ui::GestureEvent*>(&event); 231 new ui::GestureEvent(
232 held_repostable_event_.reset(new ui::GestureEvent( 232 static_cast<const ui::GestureEvent&>(event),
233 gesture_event->type(), 233 static_cast<aura::Window*>(event.target()),
234 gesture_event->root_location().x(), 234 static_cast<aura::Window*>(this)));
235 gesture_event->root_location().y(),
236 gesture_event->flags(),
237 gesture_event->time_stamp(),
238 gesture_event->details(),
239 gesture_event->touch_ids_bitfield()));
240 } 235 }
241 base::MessageLoop::current()->PostTask( 236 base::MessageLoop::current()->PostTask(
242 FROM_HERE, 237 FROM_HERE,
243 base::Bind(&RootWindow::DispatchHeldEvents, 238 base::Bind(&RootWindow::DispatchHeldEvents,
244 repostable_event_factory_.GetWeakPtr())); 239 repostable_event_factory_.GetWeakPtr()));
245 } 240 }
246 241
247 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() { 242 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() {
248 return this; 243 return this;
249 } 244 }
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 if (event->type() != ui::ET_GESTURE_TAP_DOWN) 1021 if (event->type() != ui::ET_GESTURE_TAP_DOWN)
1027 return false; 1022 return false;
1028 1023
1029 // Cleanup stale gesture events for the old gesture target. 1024 // Cleanup stale gesture events for the old gesture target.
1030 GestureConsumer* old_consumer = GetGestureTarget(event); 1025 GestureConsumer* old_consumer = GetGestureTarget(event);
1031 if (old_consumer) 1026 if (old_consumer)
1032 CleanupGestureRecognizerState(static_cast<aura::Window*>(old_consumer)); 1027 CleanupGestureRecognizerState(static_cast<aura::Window*>(old_consumer));
1033 1028
1034 Window* new_consumer = GetEventHandlerForPoint(event->root_location()); 1029 Window* new_consumer = GetEventHandlerForPoint(event->root_location());
1035 if (new_consumer) { 1030 if (new_consumer) {
1031 ui::GestureEvent begin_gesture(
1032 ui::ET_GESTURE_BEGIN,
1033 event->x(),
1034 event->y(),
1035 event->flags(),
1036 event->time_stamp(),
1037 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0, 0),
1038 event->touch_ids_bitfield());
1039 ProcessEvent(new_consumer, &begin_gesture);
1036 ProcessEvent(new_consumer, event); 1040 ProcessEvent(new_consumer, event);
1037 return event->handled(); 1041 return event->handled();
1038 } 1042 }
1039 return false; 1043 return false;
1040 } 1044 }
1041 1045
1042 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, 1046 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event,
1043 Window* target) { 1047 Window* target) {
1044 client::CursorClient* cursor_client = client::GetCursorClient(this); 1048 client::CursorClient* cursor_client = client::GetCursorClient(this);
1045 if (cursor_client && 1049 if (cursor_client &&
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 } 1223 }
1220 1224
1221 gfx::Transform RootWindow::GetInverseRootTransform() const { 1225 gfx::Transform RootWindow::GetInverseRootTransform() const {
1222 float scale = ui::GetDeviceScaleFactor(layer()); 1226 float scale = ui::GetDeviceScaleFactor(layer());
1223 gfx::Transform transform; 1227 gfx::Transform transform;
1224 transform.Scale(1.0f / scale, 1.0f / scale); 1228 transform.Scale(1.0f / scale, 1.0f / scale);
1225 return transformer_->GetInverseTransform() * transform; 1229 return transformer_->GetInverseTransform() * transform;
1226 } 1230 }
1227 1231
1228 } // namespace aura 1232 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698