OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/desktop.h" | 5 #include "ui/aura/desktop.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "ui/aura/desktop_host.h" | 9 #include "ui/aura/desktop_host.h" |
10 #include "ui/aura/focus_manager.h" | 10 #include "ui/aura/focus_manager.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void Desktop::WindowDestroying(Window* window) { | 126 void Desktop::WindowDestroying(Window* window) { |
127 if (in_destructor_ || window != active_window_) | 127 if (in_destructor_ || window != active_window_) |
128 return; | 128 return; |
129 | 129 |
130 // Reset active_window_ before invoking SetActiveWindow so that we don't | 130 // Reset active_window_ before invoking SetActiveWindow so that we don't |
131 // attempt to notify it while running its destructor. | 131 // attempt to notify it while running its destructor. |
132 active_window_ = NULL; | 132 active_window_ = NULL; |
133 SetActiveWindow(GetTopmostWindowToActivate(window), NULL); | 133 SetActiveWindow(GetTopmostWindowToActivate(window), NULL); |
134 } | 134 } |
135 | 135 |
136 bool Desktop::DispatchNativeEvent(const ui::NativeEvent& event) { | 136 bool Desktop::DispatchNativeEvent(const base::NativeEvent& event) { |
137 // TODO(oshima): consolidate windows and linux. | 137 // TODO(oshima): consolidate windows and linux. |
138 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
139 return host_->Dispatch(event); | 139 return host_->Dispatch(event); |
140 #else | 140 #else |
141 return host_->Dispatch(event) != base::MessagePumpDispatcher::EVENT_IGNORED; | 141 return host_->Dispatch(event) != base::MessagePumpDispatcher::EVENT_IGNORED; |
142 #endif | 142 #endif |
143 } | 143 } |
144 | 144 |
145 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { | 145 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { |
146 Window::Windows windows(default_parent_->children()); | 146 Window::Windows windows(default_parent_->children()); |
147 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); | 147 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); |
148 i != windows.rend(); ++i) { | 148 i != windows.rend(); ++i) { |
149 if (*i != ignore && (*i)->IsVisible() && | 149 if (*i != ignore && (*i)->IsVisible() && |
150 (*i)->delegate()->ShouldActivate(NULL)) | 150 (*i)->delegate()->ShouldActivate(NULL)) |
151 return *i; | 151 return *i; |
152 } | 152 } |
153 return NULL; | 153 return NULL; |
154 } | 154 } |
155 | 155 |
156 // static | 156 // static |
157 Desktop* Desktop::GetInstance() { | 157 Desktop* Desktop::GetInstance() { |
158 if (!instance_) { | 158 if (!instance_) { |
159 instance_ = new Desktop; | 159 instance_ = new Desktop; |
160 instance_->Init(); | 160 instance_->Init(); |
161 } | 161 } |
162 return instance_; | 162 return instance_; |
163 } | 163 } |
164 | 164 |
165 } // namespace aura | 165 } // namespace aura |
OLD | NEW |