| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "ui/aura/desktop_delegate.h" | 10 #include "ui/aura/desktop_delegate.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void Desktop::WindowDestroying(Window* window) { | 153 void Desktop::WindowDestroying(Window* window) { |
| 154 if (in_destructor_ || window != active_window_) | 154 if (in_destructor_ || window != active_window_) |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 // Reset active_window_ before invoking SetActiveWindow so that we don't | 157 // Reset active_window_ before invoking SetActiveWindow so that we don't |
| 158 // attempt to notify it while running its destructor. | 158 // attempt to notify it while running its destructor. |
| 159 active_window_ = NULL; | 159 active_window_ = NULL; |
| 160 SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL); | 160 SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void Desktop::WindowAdded(Window* window) { |
| 164 if (delegate_.get()) |
| 165 delegate_->WindowAdded(window); |
| 166 } |
| 167 |
| 168 void Desktop::WillRemoveWindow(Window* window) { |
| 169 if (delegate_.get()) |
| 170 delegate_->WillRemoveWindow(window); |
| 171 } |
| 172 |
| 163 MessageLoop::Dispatcher* Desktop::GetDispatcher() { | 173 MessageLoop::Dispatcher* Desktop::GetDispatcher() { |
| 164 return host_.get(); | 174 return host_.get(); |
| 165 } | 175 } |
| 166 | 176 |
| 167 // static | 177 // static |
| 168 Desktop* Desktop::GetInstance() { | 178 Desktop* Desktop::GetInstance() { |
| 169 if (!instance_) { | 179 if (!instance_) { |
| 170 instance_ = new Desktop; | 180 instance_ = new Desktop; |
| 171 instance_->Init(); | 181 instance_->Init(); |
| 172 } | 182 } |
| 173 return instance_; | 183 return instance_; |
| 174 } | 184 } |
| 175 | 185 |
| 176 } // namespace aura | 186 } // namespace aura |
| OLD | NEW |