| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 void Desktop::Init() { | 51 void Desktop::Init() { |
| 52 window_->Init(); | 52 window_->Init(); |
| 53 compositor()->SetRootLayer(window_->layer()); | 53 compositor()->SetRootLayer(window_->layer()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void Desktop::CreateDefaultParentForTesting() { | 56 void Desktop::CreateDefaultParentForTesting() { |
| 57 Window* default_parent = new internal::ToplevelWindowContainer; | 57 Window* default_parent = new internal::ToplevelWindowContainer; |
| 58 default_parent->Init(); | 58 default_parent->Init(); |
| 59 default_parent->SetBounds(window_->bounds()); | 59 default_parent->SetBounds(window_->bounds()); |
| 60 default_parent->SetVisibility(Window::VISIBILITY_SHOWN); | 60 default_parent->Show(); |
| 61 window_->AddChild(default_parent); | 61 window_->AddChild(default_parent); |
| 62 set_default_parent(default_parent); | 62 set_default_parent(default_parent); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void Desktop::Show() { | 65 void Desktop::Show() { |
| 66 host_->Show(); | 66 host_->Show(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void Desktop::SetSize(const gfx::Size& size) { | 69 void Desktop::SetSize(const gfx::Size& size) { |
| 70 host_->SetSize(size); | 70 host_->SetSize(size); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Reset active_window_ before invoking SetActiveWindow so that we don't | 129 // Reset active_window_ before invoking SetActiveWindow so that we don't |
| 130 // attempt to notify it while running its destructor. | 130 // attempt to notify it while running its destructor. |
| 131 active_window_ = NULL; | 131 active_window_ = NULL; |
| 132 SetActiveWindow(GetTopmostWindowToActivate(window), NULL); | 132 SetActiveWindow(GetTopmostWindowToActivate(window), NULL); |
| 133 } | 133 } |
| 134 | 134 |
| 135 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { | 135 Window* Desktop::GetTopmostWindowToActivate(Window* ignore) { |
| 136 Window::Windows windows(default_parent_->children()); | 136 Window::Windows windows(default_parent_->children()); |
| 137 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); | 137 for (Window::Windows::const_reverse_iterator i = windows.rbegin(); |
| 138 i != windows.rend(); ++i) { | 138 i != windows.rend(); ++i) { |
| 139 if (*i != ignore && (*i)->visibility() == Window::VISIBILITY_SHOWN && | 139 if (*i != ignore && (*i)->visible() && |
| 140 (*i)->delegate()->ShouldActivate(NULL)) | 140 (*i)->delegate()->ShouldActivate(NULL)) |
| 141 return *i; | 141 return *i; |
| 142 } | 142 } |
| 143 return NULL; | 143 return NULL; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // static | 146 // static |
| 147 Desktop* Desktop::GetInstance() { | 147 Desktop* Desktop::GetInstance() { |
| 148 if (!instance_) { | 148 if (!instance_) { |
| 149 instance_ = new Desktop; | 149 instance_ = new Desktop; |
| 150 instance_->Init(); | 150 instance_->Init(); |
| 151 } | 151 } |
| 152 return instance_; | 152 return instance_; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace aura | 155 } // namespace aura |
| OLD | NEW |