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

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

Issue 9221014: aura: Gesture event plumbing (skeleton). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/test/test_event_filter.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 (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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (target) { 206 if (target) {
207 TouchEvent translated_event(*event, this, target); 207 TouchEvent translated_event(*event, this, target);
208 ui::TouchStatus status = ProcessTouchEvent(target, &translated_event); 208 ui::TouchStatus status = ProcessTouchEvent(target, &translated_event);
209 if (status == ui::TOUCH_STATUS_START) 209 if (status == ui::TOUCH_STATUS_START)
210 touch_event_handler_ = target; 210 touch_event_handler_ = target;
211 else if (status == ui::TOUCH_STATUS_END || 211 else if (status == ui::TOUCH_STATUS_END ||
212 status == ui::TOUCH_STATUS_CANCEL) 212 status == ui::TOUCH_STATUS_CANCEL)
213 touch_event_handler_ = NULL; 213 touch_event_handler_ = NULL;
214 handled = status != ui::TOUCH_STATUS_UNKNOWN; 214 handled = status != ui::TOUCH_STATUS_UNKNOWN;
215 } 215 }
216
217 if (!handled) {
218 // TODO(sad): Send the touch to the gesture recognizer.
219 }
220
216 return handled; 221 return handled;
217 } 222 }
218 223
224 bool RootWindow::DispatchGestureEvent(GestureEvent* event) {
225 // TODO(sad):
226 return false;
227 }
228
219 void RootWindow::OnHostResized(const gfx::Size& size) { 229 void RootWindow::OnHostResized(const gfx::Size& size) {
220 // The compositor should have the same size as the native root window host. 230 // The compositor should have the same size as the native root window host.
221 compositor_->WidgetSizeChanged(size); 231 compositor_->WidgetSizeChanged(size);
222 232
223 // The layer, and all the observers should be notified of the 233 // The layer, and all the observers should be notified of the
224 // transformed size of the root window. 234 // transformed size of the root window.
225 gfx::Rect bounds(size); 235 gfx::Rect bounds(size);
226 layer()->transform().TransformRect(&bounds); 236 layer()->transform().TransformRect(&bounds);
227 SetBounds(gfx::Rect(bounds.size())); 237 SetBounds(gfx::Rect(bounds.size()));
228 FOR_EACH_OBSERVER(RootWindowObserver, observers_, 238 FOR_EACH_OBSERVER(RootWindowObserver, observers_,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 for (EventFilters::const_reverse_iterator it = filters.rbegin(); 442 for (EventFilters::const_reverse_iterator it = filters.rbegin();
433 it != filters.rend(); ++it) { 443 it != filters.rend(); ++it) {
434 ui::TouchStatus status = (*it)->PreHandleTouchEvent(target, event); 444 ui::TouchStatus status = (*it)->PreHandleTouchEvent(target, event);
435 if (status != ui::TOUCH_STATUS_UNKNOWN) 445 if (status != ui::TOUCH_STATUS_UNKNOWN)
436 return status; 446 return status;
437 } 447 }
438 448
439 return target->delegate()->OnTouchEvent(event); 449 return target->delegate()->OnTouchEvent(event);
440 } 450 }
441 451
452 ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target,
453 GestureEvent* event) {
454 if (!target->IsVisible())
455 return ui::GESTURE_STATUS_UNKNOWN;
456
457 EventFilters filters;
458 GetEventFiltersToNotify(target, &filters);
459 for (EventFilters::const_reverse_iterator it = filters.rbegin();
460 it != filters.rend(); ++it) {
461 ui::GestureStatus status = (*it)->PreHandleGestureEvent(target, event);
462 if (status != ui::GESTURE_STATUS_UNKNOWN)
463 return status;
464 }
465
466 return target->delegate()->OnGestureEvent(event);
467 }
468
442 void RootWindow::ScheduleDraw() { 469 void RootWindow::ScheduleDraw() {
443 if (!schedule_paint_factory_.HasWeakPtrs()) { 470 if (!schedule_paint_factory_.HasWeakPtrs()) {
444 MessageLoop::current()->PostTask( 471 MessageLoop::current()->PostTask(
445 FROM_HERE, 472 FROM_HERE,
446 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr())); 473 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()));
447 } 474 }
448 } 475 }
449 476
450 bool RootWindow::CanFocus() const { 477 bool RootWindow::CanFocus() const {
451 return IsVisible(); 478 return IsVisible();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { 579 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) {
553 bounds.set_size(gfx::Size(parsed_width, parsed_height)); 580 bounds.set_size(gfx::Size(parsed_width, parsed_height));
554 } else if (use_fullscreen_host_window_) { 581 } else if (use_fullscreen_host_window_) {
555 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize()); 582 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize());
556 } 583 }
557 584
558 return bounds; 585 return bounds;
559 } 586 }
560 587
561 } // namespace aura 588 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/test/test_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698