| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 Desktop::~Desktop() { | 45 Desktop::~Desktop() { |
| 46 in_destructor_ = true; | 46 in_destructor_ = true; |
| 47 if (instance_ == this) | 47 if (instance_ == this) |
| 48 instance_ = NULL; | 48 instance_ = NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Desktop::Init() { | 51 void Desktop::Init() { |
| 52 window_->Init(); | 52 window_->Init(); |
| 53 window_->Show(); |
| 53 compositor()->SetRootLayer(window_->layer()); | 54 compositor()->SetRootLayer(window_->layer()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void Desktop::CreateDefaultParentForTesting() { | 57 void Desktop::CreateDefaultParentForTesting() { |
| 57 Window* default_parent = new internal::ToplevelWindowContainer; | 58 Window* default_parent = new internal::ToplevelWindowContainer; |
| 58 default_parent->Init(); | 59 default_parent->Init(); |
| 59 default_parent->SetBounds(window_->bounds()); | 60 default_parent->SetBounds(window_->bounds()); |
| 60 default_parent->Show(); | 61 default_parent->Show(); |
| 61 window_->AddChild(default_parent); | 62 window_->AddChild(default_parent); |
| 62 set_default_parent(default_parent); | 63 set_default_parent(default_parent); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return host_->Dispatch(event); | 139 return host_->Dispatch(event); |
| 139 #else | 140 #else |
| 140 return host_->Dispatch(event) != base::MessagePumpDispatcher::EVENT_IGNORED; | 141 return host_->Dispatch(event) != base::MessagePumpDispatcher::EVENT_IGNORED; |
| 141 #endif | 142 #endif |
| 142 } | 143 } |
| 143 | 144 |
| 144 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { | 145 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { |
| 145 Window::Windows windows(default_parent_->children()); | 146 Window::Windows windows(default_parent_->children()); |
| 146 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); | 147 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); |
| 147 i != windows.rend(); ++i) { | 148 i != windows.rend(); ++i) { |
| 148 if (*i != ignore && (*i)->visible() && | 149 if (*i != ignore && (*i)->IsVisible() && |
| 149 (*i)->delegate()->ShouldActivate(NULL)) | 150 (*i)->delegate()->ShouldActivate(NULL)) |
| 150 return *i; | 151 return *i; |
| 151 } | 152 } |
| 152 return NULL; | 153 return NULL; |
| 153 } | 154 } |
| 154 | 155 |
| 155 // static | 156 // static |
| 156 Desktop* Desktop::GetInstance() { | 157 Desktop* Desktop::GetInstance() { |
| 157 if (!instance_) { | 158 if (!instance_) { |
| 158 instance_ = new Desktop; | 159 instance_ = new Desktop; |
| 159 instance_->Init(); | 160 instance_->Init(); |
| 160 } | 161 } |
| 161 return instance_; | 162 return instance_; |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace aura | 165 } // namespace aura |
| OLD | NEW |