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

Unified Diff: ui/aura_shell/workspace_controller.cc

Issue 9035001: Move some more WM functionality down into ash. (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 115655)
+++ ui/aura_shell/workspace_controller.cc (working copy)
@@ -1,127 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/aura_shell/workspace_controller.h"
-
-#include "ui/aura/client/activation_client.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"
-
-namespace aura_shell {
-namespace internal {
-
-WorkspaceController::WorkspaceController(aura::Window* viewport)
- : workspace_manager_(new WorkspaceManager(viewport)),
- launcher_model_(NULL),
- ignore_move_event_(false) {
- workspace_manager_->AddObserver(this);
- aura::RootWindow::GetInstance()->AddRootWindowObserver(this);
- aura::RootWindow::GetInstance()->AddObserver(this);
-}
-
-WorkspaceController::~WorkspaceController() {
- workspace_manager_->RemoveObserver(this);
- if (launcher_model_)
- launcher_model_->RemoveObserver(this);
- aura::RootWindow::GetInstance()->RemoveObserver(this);
- aura::RootWindow::GetInstance()->RemoveRootWindowObserver(this);
-}
-
-void WorkspaceController::ToggleOverview() {
- workspace_manager_->SetOverview(!workspace_manager_->is_overview());
-}
-
-void WorkspaceController::SetLauncherModel(LauncherModel* launcher_model) {
- DCHECK(!launcher_model_);
- launcher_model_ = launcher_model;
- launcher_model_->AddObserver(this);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WorkspaceController, aura::RootWindowObserver overrides:
-
-void WorkspaceController::OnRootWindowResized(const gfx::Size& new_size) {
- workspace_manager_->SetWorkspaceSize(new_size);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WorkspaceController, aura::WindowObserver overrides:
-
-void WorkspaceController::OnWindowPropertyChanged(aura::Window* window,
- const char* key,
- void* old) {
- if (key == aura::client::kRootWindowActiveWindow) {
- // FindBy handles NULL.
- Workspace* workspace = workspace_manager_->FindBy(GetActiveWindow());
- if (workspace)
- workspace->Activate();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WorkspaceController, aura_shell::internal::WorkspaceObserver overrides:
-
-void WorkspaceController::WindowMoved(WorkspaceManager* manager,
- aura::Window* source,
- aura::Window* target) {
- if (ignore_move_event_ || !launcher_model_)
- return;
- int start_index = launcher_model_->ItemIndexByWindow(source);
- int target_index = launcher_model_->ItemIndexByWindow(target);
- // The following condition may not be hold depending on future
- // launcher design. Using DCHECK so that we can catch such change.
- DCHECK(start_index >=0);
- DCHECK(target_index >=0);
-
- ignore_move_event_ = true;
- launcher_model_->Move(start_index, target_index);
- ignore_move_event_ = false;
-}
-
-void WorkspaceController::ActiveWorkspaceChanged(WorkspaceManager* manager,
- Workspace* old) {
- // TODO(oshima): Update Launcher and Status area state when the active
- // workspace's fullscreen state changes.
- //NOTIMPLEMENTED();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WorkspaceController, aura_shell::LauncherModelObserver overrides:
-
-void WorkspaceController::LauncherItemAdded(int index) {
-}
-
-void WorkspaceController::LauncherItemRemoved(int index) {
-}
-
-void WorkspaceController::LauncherItemMoved(int start_index, int target_index) {
- if (ignore_move_event_)
- return;
- DCHECK(launcher_model_);
- // Adjust target/source indices as the item positions in |launcher_model_|
- // has already been updated.
- aura::Window* start = launcher_model_->items()[target_index].window;
- size_t target_index_in_model =
- start_index < target_index ? target_index - 1 : target_index + 1;
- DCHECK_LE(target_index_in_model, launcher_model_->items().size());
- aura::Window* target = launcher_model_->items()[target_index_in_model].window;
-
- ignore_move_event_ = true;
- workspace_manager_->RotateWindows(start, target);
- ignore_move_event_ = false;
-}
-
-void WorkspaceController::LauncherItemImagesChanged(int index) {
-}
-
-} // namespace internal
-} // namespace aura_shell
« 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