OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 virtual ~EventFilterForPopupExit() { | 390 virtual ~EventFilterForPopupExit() { |
391 aura::Env::GetInstance()->RemovePreTargetHandler(this); | 391 aura::Env::GetInstance()->RemovePreTargetHandler(this); |
392 } | 392 } |
393 | 393 |
394 // Overridden from ui::EventHandler | 394 // Overridden from ui::EventHandler |
395 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 395 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
396 rwhva_->ApplyEventFilterForPopupExit(event); | 396 rwhva_->ApplyEventFilterForPopupExit(event); |
397 } | 397 } |
398 | 398 |
| 399 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { |
| 400 rwhva_->ApplyEventFilterForPopupExit(event); |
| 401 } |
| 402 |
399 private: | 403 private: |
400 RenderWidgetHostViewAura* rwhva_; | 404 RenderWidgetHostViewAura* rwhva_; |
401 | 405 |
402 DISALLOW_COPY_AND_ASSIGN(EventFilterForPopupExit); | 406 DISALLOW_COPY_AND_ASSIGN(EventFilterForPopupExit); |
403 }; | 407 }; |
404 | 408 |
405 void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit( | 409 void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit( |
406 ui::MouseEvent* event) { | 410 ui::LocatedEvent* event) { |
407 if (in_shutdown_ || is_fullscreen_) | 411 if (in_shutdown_ || is_fullscreen_ || !event->target()) |
408 return; | 412 return; |
409 | 413 |
410 if (event->type() != ui::ET_MOUSE_PRESSED || !event->target()) | 414 if (event->type() != ui::ET_MOUSE_PRESSED && |
| 415 event->type() != ui::ET_TOUCH_PRESSED) { |
411 return; | 416 return; |
| 417 } |
412 | 418 |
413 aura::Window* target = static_cast<aura::Window*>(event->target()); | 419 aura::Window* target = static_cast<aura::Window*>(event->target()); |
414 if (target != window_ && | 420 if (target != window_ && |
415 (!popup_parent_host_view_ || | 421 (!popup_parent_host_view_ || |
416 target != popup_parent_host_view_->window_)) { | 422 target != popup_parent_host_view_->window_)) { |
417 // Note: popup_parent_host_view_ may be NULL when there are multiple | 423 // Note: popup_parent_host_view_ may be NULL when there are multiple |
418 // popup children per view. See: RenderWidgetHostViewAura::InitAsPopup(). | 424 // popup children per view. See: RenderWidgetHostViewAura::InitAsPopup(). |
419 in_shutdown_ = true; | 425 in_shutdown_ = true; |
420 host_->Shutdown(); | 426 host_->Shutdown(); |
421 } | 427 } |
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 RenderWidgetHost* widget) { | 3574 RenderWidgetHost* widget) { |
3569 return new RenderWidgetHostViewAura(widget); | 3575 return new RenderWidgetHostViewAura(widget); |
3570 } | 3576 } |
3571 | 3577 |
3572 // static | 3578 // static |
3573 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3579 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3574 GetScreenInfoForWindow(results, NULL); | 3580 GetScreenInfoForWindow(results, NULL); |
3575 } | 3581 } |
3576 | 3582 |
3577 } // namespace content | 3583 } // namespace content |
OLD | NEW |