Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: ui/aura/desktop.cc

Issue 8194004: change the way windows are parented when their parent is set to NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/desktop_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_) {
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/desktop_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698