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

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

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
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 #include "ui/aura/env.h" 5 #include "ui/aura/env.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/client/screen_position_client.h" 8 #include "ui/aura/client/screen_position_client.h"
9 #include "ui/aura/env_observer.h" 9 #include "ui/aura/env_observer.h"
10 #include "ui/aura/event_filter.h" 10 #include "ui/aura/event_filter.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 void Env::SetDisplayManager(DisplayManager* display_manager) { 92 void Env::SetDisplayManager(DisplayManager* display_manager) {
93 display_manager_.reset(display_manager); 93 display_manager_.reset(display_manager);
94 #if defined(USE_X11) 94 #if defined(USE_X11)
95 // Update the display manager with latest info. 95 // Update the display manager with latest info.
96 display_change_observer_->NotifyDisplayChange(); 96 display_change_observer_->NotifyDisplayChange();
97 #endif 97 #endif
98 } 98 }
99 99
100 void Env::SetEventFilter(EventFilter* event_filter) { 100 void Env::AddPreTargetEventHandler(ui::EventHandler* handler) {
101 event_filter_.reset(event_filter); 101 if (handler)
102 pre_target_handlers_.push_back(handler);
103 }
104
105 void Env::RemovePreTargetEventHandler(ui::EventHandler* handler) {
106 ui::EventHandlerList::iterator find =
107 std::find(pre_target_handlers_.begin(),
108 pre_target_handlers_.end(),
109 handler);
110 if (find != pre_target_handlers_.end())
111 pre_target_handlers_.erase(find);
112 }
113
114 void Env::AddPostTargetEventHandler(ui::EventHandler* handler) {
115 if (handler)
116 post_target_handlers_.push_back(handler);
117 }
118
119 void Env::RemovePostTargetEventHandler(ui::EventHandler* handler) {
120 ui::EventHandlerList::iterator find =
121 std::remove(post_target_handlers_.begin(),
122 post_target_handlers_.end(),
123 handler);
124 if (find != post_target_handlers_.end())
125 post_target_handlers_.erase(find);
102 } 126 }
103 127
104 #if !defined(OS_MACOSX) 128 #if !defined(OS_MACOSX)
105 MessageLoop::Dispatcher* Env::GetDispatcher() { 129 MessageLoop::Dispatcher* Env::GetDispatcher() {
106 #if defined(USE_X11) 130 #if defined(USE_X11)
107 return base::MessagePumpAuraX11::Current(); 131 return base::MessagePumpAuraX11::Current();
108 #else 132 #else
109 return dispatcher_.get(); 133 return dispatcher_.get();
110 #endif 134 #endif
111 } 135 }
(...skipping 17 matching lines...) Expand all
129 ui::Compositor::Initialize( 153 ui::Compositor::Initialize(
130 CommandLine::ForCurrentProcess()->HasSwitch( 154 CommandLine::ForCurrentProcess()->HasSwitch(
131 switches::kUIEnableThreadedCompositing)); 155 switches::kUIEnableThreadedCompositing));
132 } 156 }
133 157
134 void Env::NotifyWindowInitialized(Window* window) { 158 void Env::NotifyWindowInitialized(Window* window) {
135 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); 159 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window));
136 } 160 }
137 161
138 } // namespace aura 162 } // namespace aura
OLDNEW
« ui/aura/env.h ('K') | « ui/aura/env.h ('k') | ui/aura/root_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698