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

Side by Side Diff: views/focus/accelerator_handler.h

Issue 6487002: Add a new constructor to KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ 5 #ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_
6 #define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ 6 #define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 17 matching lines...) Expand all
28 // Keep a list of touch devices so that it is possible to determine if a pointer 28 // Keep a list of touch devices so that it is possible to determine if a pointer
29 // event is a touch-event or a mouse-event. 29 // event is a touch-event or a mouse-event.
30 void SetTouchDeviceList(std::vector<unsigned int>& devices); 30 void SetTouchDeviceList(std::vector<unsigned int>& devices);
31 #endif // HAVE_XINPUT2 31 #endif // HAVE_XINPUT2
32 #endif // TOUCH_UI 32 #endif // TOUCH_UI
33 33
34 // This class delegates the key messages to the associated FocusManager class 34 // This class delegates the key messages to the associated FocusManager class
35 // for the window that is receiving these messages for accelerator processing. 35 // for the window that is receiving these messages for accelerator processing.
36 class AcceleratorHandler : public MessageLoopForUI::Dispatcher { 36 class AcceleratorHandler : public MessageLoopForUI::Dispatcher {
37 public: 37 public:
38 AcceleratorHandler(); 38 AcceleratorHandler();
39
40 #if defined(OS_WIN)
41 // Returns the message currently being processed.
42 // Note that this may not work for message loops run by the OS.
43 static const MSG& current_message() { return current_messages_.back(); }
44 #endif
45
39 // Dispatcher method. This returns true if an accelerator was processed by the 46 // Dispatcher method. This returns true if an accelerator was processed by the
40 // focus manager 47 // focus manager
41 #if defined(OS_WIN) 48 #if defined(OS_WIN)
42 virtual bool Dispatch(const MSG& msg); 49 virtual bool Dispatch(const MSG& msg);
43 #else 50 #else
44 virtual bool Dispatch(GdkEvent* event); 51 virtual bool Dispatch(GdkEvent* event);
45 #if defined(TOUCH_UI) 52 #if defined(TOUCH_UI)
46 virtual MessagePumpGlibXDispatcher::DispatchStatus Dispatch(XEvent* xev); 53 virtual MessagePumpGlibXDispatcher::DispatchStatus Dispatch(XEvent* xev);
47 #endif 54 #endif
48 #endif 55 #endif
49 56
50 private: 57 private:
51 #if defined(OS_WIN) 58 #if defined(OS_WIN)
52 // The keys currently pressed and consumed by the FocusManager. 59 // The keys currently pressed and consumed by the FocusManager.
53 std::set<WPARAM> pressed_keys_; 60 std::set<WPARAM> pressed_keys_;
61
62 // A stack of current messages, to handle message loop nesting.
63 static std::vector<MSG> current_messages_;
sky 2011/02/10 20:59:35 statics can only be plain old data (POD).
54 #endif 64 #endif
55 65
56 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); 66 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler);
57 }; 67 };
58 68
59 } // namespace views 69 } // namespace views
60 70
61 #endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ 71 #endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698