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

Side by Side Diff: ui/views/controls/menu/menu_message_loop_aura.cc

Issue 1565013002: Don't send touch events to windows like menus when the touch occurs outside the menu bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore DCHECK Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/controls/menu/menu_message_loop_aura.h" 5 #include "ui/views/controls/menu/menu_message_loop_aura.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 }; 94 };
95 95
96 } // namespace 96 } // namespace
97 97
98 // static 98 // static
99 MenuMessageLoop* MenuMessageLoop::Create() { 99 MenuMessageLoop* MenuMessageLoop::Create() {
100 return new MenuMessageLoopAura; 100 return new MenuMessageLoopAura;
101 } 101 }
102 102
103 // static 103 // static
104 void MenuMessageLoop::RepostEventToWindow(const ui::LocatedEvent& event, 104 void MenuMessageLoop::RepostEventToWindow(const ui::LocatedEvent* event,
105 gfx::NativeWindow window, 105 gfx::NativeWindow window,
106 const gfx::Point& screen_loc) { 106 const gfx::Point& screen_loc) {
107 aura::Window* root = window->GetRootWindow(); 107 aura::Window* root = window->GetRootWindow();
108 ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); 108 aura::client::ScreenPositionClient* spc =
109 aura::client::GetScreenPositionClient(root);
109 if (!spc) 110 if (!spc)
110 return; 111 return;
111 112
112 gfx::Point root_loc(screen_loc); 113 gfx::Point root_loc(screen_loc);
113 spc->ConvertPointFromScreen(root, &root_loc); 114 spc->ConvertPointFromScreen(root, &root_loc);
114 115
115 ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); 116 scoped_ptr<ui::Event> clone = ui::Event::Clone(*event);
116 clone.set_location(root_loc); 117 scoped_ptr<ui::LocatedEvent> located_event(
117 clone.set_root_location(root_loc); 118 static_cast<ui::LocatedEvent*>(clone.release()));
118 root->GetHost()->dispatcher()->RepostEvent(clone); 119 located_event->set_location(root_loc);
120 located_event->set_root_location(root_loc);
121
122 root->GetHost()->dispatcher()->RepostEvent(located_event.get());
119 } 123 }
120 124
121 MenuMessageLoopAura::MenuMessageLoopAura() : owner_(nullptr) {} 125 MenuMessageLoopAura::MenuMessageLoopAura() : owner_(nullptr) {}
122 126
123 MenuMessageLoopAura::~MenuMessageLoopAura() {} 127 MenuMessageLoopAura::~MenuMessageLoopAura() {}
124 128
125 void MenuMessageLoopAura::Run(MenuController* controller, 129 void MenuMessageLoopAura::Run(MenuController* controller,
126 Widget* owner, 130 Widget* owner,
127 bool nested_menu) { 131 bool nested_menu) {
128 // |owner_| may be NULL. 132 // |owner_| may be NULL.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (ui::PlatformEventSource::GetInstance()) 189 if (ui::PlatformEventSource::GetInstance())
186 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream(); 190 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream();
187 #endif 191 #endif
188 } 192 }
189 193
190 void MenuMessageLoopAura::ClearOwner() { 194 void MenuMessageLoopAura::ClearOwner() {
191 owner_ = NULL; 195 owner_ = NULL;
192 } 196 }
193 197
194 } // namespace views 198 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698