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

Side by Side Diff: ash/wm/workspace/workspace_manager2.cc

Issue 10875070: Makes workspace 2 show an alternate background (system background) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace_manager2.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/workspace/workspace_manager2.h" 5 #include "ash/wm/workspace/workspace_manager2.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/screen_ash.h" 11 #include "ash/screen_ash.h"
12 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "ash/wm/base_layout_manager.h" 15 #include "ash/wm/base_layout_manager.h"
16 #include "ash/wm/property_util.h" 16 #include "ash/wm/property_util.h"
17 #include "ash/wm/shelf_layout_manager.h" 17 #include "ash/wm/shelf_layout_manager.h"
18 #include "ash/wm/window_animations.h" 18 #include "ash/wm/window_animations.h"
19 #include "ash/wm/window_properties.h" 19 #include "ash/wm/window_properties.h"
20 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
21 #include "ash/wm/workspace/system_background_controller.h"
21 #include "ash/wm/workspace/workspace_layout_manager2.h" 22 #include "ash/wm/workspace/workspace_layout_manager2.h"
22 #include "ash/wm/workspace/workspace2.h" 23 #include "ash/wm/workspace/workspace2.h"
23 #include "base/auto_reset.h" 24 #include "base/auto_reset.h"
24 #include "base/logging.h" 25 #include "base/logging.h"
25 #include "base/stl_util.h" 26 #include "base/stl_util.h"
26 #include "base/stringprintf.h" 27 #include "base/stringprintf.h"
27 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
28 #include "ui/aura/env.h" 29 #include "ui/aura/env.h"
29 #include "ui/aura/root_window.h" 30 #include "ui/aura/root_window.h"
30 #include "ui/aura/window.h" 31 #include "ui/aura/window.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (FindWorkspace(workspace) == workspaces_.end()) { 259 if (FindWorkspace(workspace) == workspaces_.end()) {
259 contents_view_->StackChildAbove(workspace->window(), 260 contents_view_->StackChildAbove(workspace->window(),
260 workspaces_.back()->window()); 261 workspaces_.back()->window());
261 workspaces_.push_back(workspace); 262 workspaces_.push_back(workspace);
262 } 263 }
263 } 264 }
264 265
265 Workspace2* last_active = active_workspace_; 266 Workspace2* last_active = active_workspace_;
266 active_workspace_ = workspace; 267 active_workspace_ = workspace;
267 268
269 destroy_background_timer_.Stop();
270 if (active_workspace_ == desktop_workspace()) {
271 destroy_background_timer_.Start(
272 FROM_HERE, GetSystemBackgroundDestroyDuration(),
273 this, &WorkspaceManager2::DestroySystemBackground);
274 } else if (!background_controller_.get()) {
275 background_controller_.reset(new SystemBackgroundController(
276 contents_view_->GetRootWindow()));
277 }
278
268 UpdateShelfVisibility(); 279 UpdateShelfVisibility();
269 280
270 if (animate_type != ANIMATE_NONE) { 281 if (animate_type != ANIMATE_NONE) {
271 AnimateBetweenWorkspaces(last_active->window(), workspace->window(), 282 AnimateBetweenWorkspaces(last_active->window(), workspace->window(),
272 (animate_type == ANIMATE_OLD_AND_NEW)); 283 (animate_type == ANIMATE_OLD_AND_NEW));
273 } 284 }
274 285
275 RootWindowController* root_controller = GetRootWindowController( 286 RootWindowController* root_controller = GetRootWindowController(
276 contents_view_->GetRootWindow()); 287 contents_view_->GetRootWindow());
277 if (root_controller) { 288 if (root_controller) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 SetActiveWorkspace(*(workspace_i - 1), animate_type); 372 SetActiveWorkspace(*(workspace_i - 1), animate_type);
362 } 373 }
363 374
364 void WorkspaceManager2::ScheduleDelete(Workspace2* workspace) { 375 void WorkspaceManager2::ScheduleDelete(Workspace2* workspace) {
365 to_delete_.insert(workspace); 376 to_delete_.insert(workspace);
366 delete_timer_.Stop(); 377 delete_timer_.Stop();
367 delete_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this, 378 delete_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
368 &WorkspaceManager2::ProcessDeletion); 379 &WorkspaceManager2::ProcessDeletion);
369 } 380 }
370 381
382 void WorkspaceManager2::DestroySystemBackground() {
383 background_controller_.reset();
384 }
385
371 void WorkspaceManager2::ProcessDeletion() { 386 void WorkspaceManager2::ProcessDeletion() {
372 std::set<Workspace2*> to_delete; 387 std::set<Workspace2*> to_delete;
373 to_delete.swap(to_delete_); 388 to_delete.swap(to_delete_);
374 for (std::set<Workspace2*>::iterator i = to_delete.begin(); 389 for (std::set<Workspace2*>::iterator i = to_delete.begin();
375 i != to_delete.end(); ++i) { 390 i != to_delete.end(); ++i) {
376 Workspace2* workspace = *i; 391 Workspace2* workspace = *i;
377 if (workspace->window()->layer()->children().empty()) { 392 if (workspace->window()->layer()->children().empty()) {
378 delete workspace->ReleaseWindow(); 393 delete workspace->ReleaseWindow();
379 delete workspace; 394 delete workspace;
380 } else { 395 } else {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 child, old_layer); 483 child, old_layer);
469 } else { 484 } else {
470 DCHECK(!old_layer); 485 DCHECK(!old_layer);
471 } 486 }
472 } 487 }
473 UpdateShelfVisibility(); 488 UpdateShelfVisibility();
474 } 489 }
475 490
476 } // namespace internal 491 } // namespace internal
477 } // namespace ash 492 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698