Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
| index 48368f962f2f3433b76c5ad20746ad28f135a481..58535cb389e31e7e6e8299477dc726e4766aedc9 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc |
| @@ -85,7 +85,8 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( |
| should_animate_window_close_(false), |
| pending_close_(false), |
| has_non_client_view_(false), |
| - tooltip_(NULL) { |
| + tooltip_(NULL), |
| + weak_factory_(this) { |
| } |
| DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { |
| @@ -824,6 +825,23 @@ void DesktopWindowTreeHostWin::HandleTouchEvent( |
| DesktopWindowTreeHostWin* target = |
| host->window()->GetProperty(kDesktopWindowTreeHostKey); |
| if (target && target->HasCapture() && target != this) { |
| + // Windows like menus need to be closed if a touch occurs outside the |
| + // bounds of the window. |
| + if ((event.type() == ui::ET_TOUCH_PRESSED) && |
| + GetWidget()->GetNativeView()->GetProperty( |
| + aura::client::kReleaseCaptureOnTouchOutside)) { |
| + target->ReleaseCapture(); |
| + // We should send the touch to the correct window. We use PostTask here |
| + // as we don't want to send the touch event in the context of the |
| + // nested loop if any. |
| + base::MessageLoop::current()->PostTask( |
|
sky
2016/01/08 23:51:56
Is there no way to have the menu code do the posti
ananta
2016/01/09 00:01:15
The touch events are handled by the gesture recogn
|
| + FROM_HERE, |
| + base::Bind(&DesktopWindowTreeHostWin::PostEventToProcessor, |
| + weak_factory_.GetWeakPtr(), |
| + event)); |
| + return; |
| + } |
| + |
| POINT target_location(event.location().ToPOINT()); |
| ClientToScreen(GetHWND(), &target_location); |
| ScreenToClient(target->GetHWND(), &target_location); |
| @@ -949,6 +967,11 @@ bool DesktopWindowTreeHostWin::IsModalWindowActive() const { |
| return false; |
| } |
| +void DesktopWindowTreeHostWin::PostEventToProcessor( |
| + const ui::Event& event) { |
| + SendEventToProcessor(const_cast<ui::Event*>(&event)); |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // DesktopWindowTreeHost, public: |