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

Side by Side Diff: ui/views/controls/menu/menu_message_loop_mac.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: Fix build redness 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_mac.h" 5 #include "ui/views/controls/menu/menu_message_loop_mac.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 // static 15 // static
16 MenuMessageLoop* MenuMessageLoop::Create() { 16 MenuMessageLoop* MenuMessageLoop::Create() {
17 return new MenuMessageLoopMac; 17 return new MenuMessageLoopMac;
18 } 18 }
19 19
20 // Force instantiation of the RepostEventToWindow function for the following
21 // EventTypes.
22 // 1. MouseEvent.
23 // 2. GestureEvent.
24 // 3. TouchEvent.
25 // Alternatively we could possibly implement the function in the header file,
26 // which I think is uglier.
27 template
28 void MenuMessageLoop::RepostEventToWindow<ui::MouseEvent>(
29 const ui::MouseEvent& event,
30 gfx::NativeWindow window,
31 const gfx::Point& screen_loc);
32
33 template
34 void MenuMessageLoop::RepostEventToWindow<ui::GestureEvent>(
35 const ui::GestureEvent& event,
36 gfx::NativeWindow window,
37 const gfx::Point& screen_loc);
38
39 template
40 void MenuMessageLoop::RepostEventToWindow<ui::TouchEvent>(
41 const ui::TouchEvent& event,
42 gfx::NativeWindow window,
43 const gfx::Point& screen_loc);
44
20 // static 45 // static
21 void MenuMessageLoop::RepostEventToWindow(const ui::LocatedEvent& event, 46 template<class EventType>
47 void MenuMessageLoop::RepostEventToWindow(const EventType& event,
22 gfx::NativeWindow window, 48 gfx::NativeWindow window,
23 const gfx::Point& screen_loc) { 49 const gfx::Point& screen_loc) {
24 NOTIMPLEMENTED(); 50 NOTIMPLEMENTED();
25 } 51 }
26 52
27 MenuMessageLoopMac::MenuMessageLoopMac() {} 53 MenuMessageLoopMac::MenuMessageLoopMac() {}
28 54
29 MenuMessageLoopMac::~MenuMessageLoopMac() {} 55 MenuMessageLoopMac::~MenuMessageLoopMac() {}
30 56
31 void MenuMessageLoopMac::Run(MenuController* controller, 57 void MenuMessageLoopMac::Run(MenuController* controller,
32 Widget* owner, 58 Widget* owner,
33 bool nested_menu) { 59 bool nested_menu) {
34 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 60 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
35 base::MessageLoop::ScopedNestableTaskAllower allow(loop); 61 base::MessageLoop::ScopedNestableTaskAllower allow(loop);
36 base::RunLoop run_loop; 62 base::RunLoop run_loop;
37 base::AutoReset<base::RunLoop*> reset_run_loop(&run_loop_, &run_loop); 63 base::AutoReset<base::RunLoop*> reset_run_loop(&run_loop_, &run_loop);
38 run_loop.Run(); 64 run_loop.Run();
39 } 65 }
40 66
41 void MenuMessageLoopMac::QuitNow() { 67 void MenuMessageLoopMac::QuitNow() {
42 DCHECK(run_loop_); 68 DCHECK(run_loop_);
43 run_loop_->Quit(); 69 run_loop_->Quit();
44 } 70 }
45 71
46 void MenuMessageLoopMac::ClearOwner() { 72 void MenuMessageLoopMac::ClearOwner() {
47 } 73 }
48 74
49 } // namespace views 75 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698