| Index: ui/aura/desktop.cc
|
| ===================================================================
|
| --- ui/aura/desktop.cc (revision 104542)
|
| +++ ui/aura/desktop.cc (working copy)
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/message_loop.h"
|
| +#include "ui/aura/desktop_delegate.h"
|
| #include "ui/aura/desktop_host.h"
|
| #include "ui/aura/focus_manager.h"
|
| #include "ui/aura/root_window.h"
|
| @@ -24,13 +25,11 @@
|
| ui::Compositor*(*Desktop::compositor_factory_)() = NULL;
|
|
|
| Desktop::Desktop()
|
| - : default_parent_(NULL),
|
| + : delegate_(NULL),
|
| host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1280, 1024))),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)),
|
| active_window_(NULL),
|
| in_destructor_(false) {
|
| - DCHECK(MessageLoopForUI::current())
|
| - << "The UI message loop must be initialized first.";
|
| if (compositor_factory_) {
|
| compositor_ = (*Desktop::compositor_factory())();
|
| } else {
|
| @@ -55,15 +54,6 @@
|
| compositor()->SetRootLayer(window_->layer());
|
| }
|
|
|
| -void Desktop::CreateDefaultParentForTesting() {
|
| - Window* default_parent = new internal::ToplevelWindowContainer;
|
| - default_parent->Init();
|
| - default_parent->SetBounds(window_->bounds());
|
| - default_parent->Show();
|
| - window_->AddChild(default_parent);
|
| - set_default_parent(default_parent);
|
| -}
|
| -
|
| void Desktop::Show() {
|
| host_->Show();
|
| }
|
| @@ -125,7 +115,7 @@
|
| }
|
|
|
| void Desktop::ActivateTopmostWindow() {
|
| - SetActiveWindow(GetTopmostWindowToActivate(NULL), NULL);
|
| + SetActiveWindow(delegate_->GetTopmostWindowToActivate(NULL), NULL);
|
| }
|
|
|
| void Desktop::WindowDestroying(Window* window) {
|
| @@ -135,7 +125,7 @@
|
| // Reset active_window_ before invoking SetActiveWindow so that we don't
|
| // attempt to notify it while running its destructor.
|
| active_window_ = NULL;
|
| - SetActiveWindow(GetTopmostWindowToActivate(window), NULL);
|
| + SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL);
|
| }
|
|
|
| MessageLoop::Dispatcher* Desktop::GetDispatcher() {
|
| @@ -143,17 +133,6 @@
|
| }
|
|
|
|
|
| -Window* Desktop::GetTopmostWindowToActivate(Window* ignore) {
|
| - Window::Windows windows(default_parent_->children());
|
| - for (Window::Windows::const_reverse_iterator i = windows.rbegin();
|
| - i != windows.rend(); ++i) {
|
| - if (*i != ignore && (*i)->IsVisible() &&
|
| - (*i)->delegate()->ShouldActivate(NULL))
|
| - return *i;
|
| - }
|
| - return NULL;
|
| -}
|
| -
|
| // static
|
| Desktop* Desktop::GetInstance() {
|
| if (!instance_) {
|
|
|