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

Unified Diff: ui/aura_shell/workspace_controller.cc

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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_shell/workspace_controller.h ('k') | ui/aura_shell/workspace_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/workspace_controller.cc
===================================================================
--- ui/aura_shell/workspace_controller.cc (revision 114022)
+++ ui/aura_shell/workspace_controller.cc (working copy)
@@ -4,12 +4,14 @@
#include "ui/aura_shell/workspace_controller.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura_shell/default_container_layout_manager.h"
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/launcher/launcher_model.h"
#include "ui/aura_shell/shell.h"
+#include "ui/aura_shell/window_util.h"
#include "ui/aura_shell/workspace/workspace.h"
#include "ui/aura_shell/workspace/workspace_manager.h"
@@ -21,6 +23,7 @@
launcher_model_(NULL),
ignore_move_event_(false) {
workspace_manager_->AddObserver(this);
+ aura::RootWindow::GetInstance()->AddRootWindowObserver(this);
aura::RootWindow::GetInstance()->AddObserver(this);
}
@@ -29,6 +32,7 @@
if (launcher_model_)
launcher_model_->RemoveObserver(this);
aura::RootWindow::GetInstance()->RemoveObserver(this);
+ aura::RootWindow::GetInstance()->RemoveRootWindowObserver(this);
}
void WorkspaceController::ToggleOverview() {
@@ -48,11 +52,18 @@
workspace_manager_->SetWorkspaceSize(new_size);
}
-void WorkspaceController::OnActiveWindowChanged(aura::Window* active) {
- // FindBy handles NULL.
- Workspace* workspace = workspace_manager_->FindBy(active);
- if (workspace)
- workspace->Activate();
+////////////////////////////////////////////////////////////////////////////////
+// WorkspaceController, aura::WindowObserver overrides:
+
+void WorkspaceController::OnWindowPropertyChanged(aura::Window* window,
+ const char* key,
+ void* old) {
+ if (key == aura::kRootWindowActiveWindow) {
+ // FindBy handles NULL.
+ Workspace* workspace = workspace_manager_->FindBy(GetActiveWindow());
+ if (workspace)
+ workspace->Activate();
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/aura_shell/workspace_controller.h ('k') | ui/aura_shell/workspace_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698