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

Side by Side Diff: ui/aura/env.h

Issue 10960015: aura: Start converting event-filters into event-handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leak Created 8 years, 3 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
« no previous file with comments | « ash/shell.cc ('k') | ui/aura/env.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_AURA_ENV_H_ 5 #ifndef UI_AURA_ENV_H_
6 #define UI_AURA_ENV_H_ 6 #define UI_AURA_ENV_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "ui/aura/aura_export.h" 11 #include "ui/aura/aura_export.h"
12 #include "ui/aura/client/stacking_client.h" 12 #include "ui/aura/client/stacking_client.h"
13 #include "ui/base/events/event_handler.h"
13 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
14 15
15 #if defined(USE_X11) 16 #if defined(USE_X11)
16 #include "ui/aura/device_list_updater_aurax11.h" 17 #include "ui/aura/device_list_updater_aurax11.h"
17 #endif 18 #endif
18 19
19 namespace aura { 20 namespace aura {
20 class EnvObserver; 21 class EnvObserver;
21 class EventFilter; 22 class EventFilter;
22 class DisplayManager; 23 class DisplayManager;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 client::StackingClient* stacking_client() { return stacking_client_; } 74 client::StackingClient* stacking_client() { return stacking_client_; }
74 void set_stacking_client(client::StackingClient* stacking_client) { 75 void set_stacking_client(client::StackingClient* stacking_client) {
75 stacking_client_ = stacking_client; 76 stacking_client_ = stacking_client;
76 } 77 }
77 78
78 // Gets/sets DisplayManager. The DisplayManager's ownership is 79 // Gets/sets DisplayManager. The DisplayManager's ownership is
79 // transfered. 80 // transfered.
80 DisplayManager* display_manager() { return display_manager_.get(); } 81 DisplayManager* display_manager() { return display_manager_.get(); }
81 void SetDisplayManager(DisplayManager* display_manager); 82 void SetDisplayManager(DisplayManager* display_manager);
82 83
83 // Env takes ownership of the EventFilter. 84 // Add event handler for pre-target of post-target phases.
84 EventFilter* event_filter() { return event_filter_.get(); } 85 void AddPreTargetEventHandler(ui::EventHandler* handler);
Ben Goodger (Google) 2012/09/20 21:29:48 qq: could Env be an EventTarget with a NULL target
sadrul 2012/09/20 22:33:31 Oh, very interesting. I made this change (RootWind
85 void SetEventFilter(EventFilter* event_filter); 86 void RemovePreTargetEventHandler(ui::EventHandler* handler);
87 void AddPostTargetEventHandler(ui::EventHandler* handler);
88 void RemovePostTargetEventHandler(ui::EventHandler* handler);
89
90 const ui::EventHandlerList& pre_target_handlers() const {
91 return pre_target_handlers_;
92 }
86 93
87 // Returns the native event dispatcher. The result should only be passed to 94 // Returns the native event dispatcher. The result should only be passed to
88 // base::RunLoop(dispatcher), or used to dispatch an event by 95 // base::RunLoop(dispatcher), or used to dispatch an event by
89 // |Dispatch(const NativeEvent&)| on it. It must never be stored. 96 // |Dispatch(const NativeEvent&)| on it. It must never be stored.
90 #if !defined(OS_MACOSX) 97 #if !defined(OS_MACOSX)
91 MessageLoop::Dispatcher* GetDispatcher(); 98 MessageLoop::Dispatcher* GetDispatcher();
92 #endif 99 #endif
93 100
94 private: 101 private:
95 friend class Window; 102 friend class Window;
(...skipping 12 matching lines...) Expand all
108 int mouse_button_flags_; 115 int mouse_button_flags_;
109 // Location of last mouse event, in screen coordinates. 116 // Location of last mouse event, in screen coordinates.
110 gfx::Point last_mouse_location_; 117 gfx::Point last_mouse_location_;
111 // If the cursor is hidden, saves the previous last_mouse_position. 118 // If the cursor is hidden, saves the previous last_mouse_position.
112 gfx::Point hidden_cursor_location_; 119 gfx::Point hidden_cursor_location_;
113 bool is_cursor_hidden_; 120 bool is_cursor_hidden_;
114 bool is_touch_down_; 121 bool is_touch_down_;
115 bool render_white_bg_; 122 bool render_white_bg_;
116 client::StackingClient* stacking_client_; 123 client::StackingClient* stacking_client_;
117 scoped_ptr<DisplayManager> display_manager_; 124 scoped_ptr<DisplayManager> display_manager_;
118 scoped_ptr<EventFilter> event_filter_; 125
126 ui::EventHandlerList pre_target_handlers_;
127 ui::EventHandlerList post_target_handlers_;
119 128
120 #if defined(USE_X11) 129 #if defined(USE_X11)
121 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_; 130 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_;
122 DeviceListUpdaterAuraX11 device_list_updater_aurax11_; 131 DeviceListUpdaterAuraX11 device_list_updater_aurax11_;
123 #endif 132 #endif
124 133
125 DISALLOW_COPY_AND_ASSIGN(Env); 134 DISALLOW_COPY_AND_ASSIGN(Env);
126 }; 135 };
127 136
128 } // namespace aura 137 } // namespace aura
129 138
130 #endif // UI_AURA_ENV_H_ 139 #endif // UI_AURA_ENV_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ui/aura/env.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698