Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| index 1a37ff8ca16dda4a37b679b4e8f6c9671039dd6c..56100d1a02104c166934f7fd95342ac81ac0b5e1 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -175,6 +175,19 @@ bool ShouldReleaseFrontSurface() { |
| return release_front_surface_allowed; |
| } |
| +bool PointerEventActivates(const ui::Event& event) { |
| + if (event.type() == ui::ET_MOUSE_PRESSED) |
| + return true; |
| + |
| + if (event.type() == ui::ET_GESTURE_BEGIN) { |
| + const ui::GestureEvent& gesture = |
| + static_cast<const ui::GestureEvent&>(event); |
| + return gesture.details().touch_points() == 1; |
| + } |
| + |
| + return false; |
| +} |
| + |
| } // namespace |
| // We have to implement the WindowObserver interface on a separate object |
| @@ -285,8 +298,7 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) |
| paint_canvas_(NULL), |
| synthetic_move_sent_(false), |
| accelerated_compositing_state_changed_(false), |
| - can_lock_compositor_(YES), |
| - pointer_activate_(false) { |
| + can_lock_compositor_(YES) { |
| host_->SetView(this); |
| window_observer_.reset(new WindowObserver(this)); |
| window_->AddObserver(window_observer_.get()); |
| @@ -1542,7 +1554,6 @@ ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
| TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); |
| - pointer_activate_ = event->type() == ui::ET_MOUSE_PRESSED; |
| if (mouse_locked_) { |
| // Hide the cursor if someone else has shown it. |
| @@ -1685,11 +1696,9 @@ ui::EventResult RenderWidgetHostViewAura::OnGestureEvent( |
| if (popup_type_ == WebKit::WebPopupTypeNone && !is_fullscreen_) |
| delegate = RenderViewHost::From(host_)->GetDelegate(); |
| - bool gesture_begin = event->type() == ui::ET_GESTURE_BEGIN && |
| - event->details().touch_points() == 1; |
| - if (delegate && gesture_begin) |
| + if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
| + event->details().touch_points() == 1) |
|
Ben Goodger (Google)
2012/11/30 21:29:02
nit: braces
sadrul
2012/11/30 21:36:14
Done.
|
| delegate->HandleGestureBegin(); |
| - pointer_activate_ = gesture_begin; |
| WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); |
| if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| @@ -1728,17 +1737,15 @@ ui::EventResult RenderWidgetHostViewAura::OnGestureEvent( |
| // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: |
| bool RenderWidgetHostViewAura::ShouldActivate() const { |
| + const ui::Event* event = window_->GetRootWindow()->current_event(); |
|
Ben Goodger (Google)
2012/11/30 21:29:02
do we need this?
sadrul
2012/11/30 21:36:14
It looks like the old-code used to return true whe
|
| + if (!event) |
| + return true; |
| return is_fullscreen_; |
| } |
| void RenderWidgetHostViewAura::OnActivated() { |
| - // |pointer_activate_| will be true when we are activated as the result of |
| - // a valid input event. |
| - // TODO(sadrul): It would be nice if we could get the currently processed |
| - // event from the RootWindow's EventDispatcher, then we could |
| - // avoid this extra field and just check the type/details on |
| - // the current event here. |
| - if (pointer_activate_) |
| + const ui::Event* event = window_->GetRootWindow()->current_event(); |
| + if (event && PointerEventActivates(*event)) |
| host_->OnPointerEventActivate(); |
| } |