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

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

Issue 11087009: Merge 159822 - ash: Display system background while loading wallpaper. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace_manager2.h ('k') | chrome/browser/ui/ash/chrome_shell_delegate.h » ('j') | 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/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/wm/base_layout_manager.h" 13 #include "ash/wm/base_layout_manager.h"
14 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
15 #include "ash/wm/shelf_layout_manager.h" 15 #include "ash/wm/shelf_layout_manager.h"
16 #include "ash/wm/window_animations.h" 16 #include "ash/wm/window_animations.h"
17 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "ash/wm/workspace/system_background_controller.h"
20 #include "ash/wm/workspace/workspace_layout_manager2.h" 19 #include "ash/wm/workspace/workspace_layout_manager2.h"
21 #include "ash/wm/workspace/workspace2.h" 20 #include "ash/wm/workspace/workspace2.h"
22 #include "base/auto_reset.h" 21 #include "base/auto_reset.h"
23 #include "base/command_line.h" 22 #include "base/command_line.h"
24 #include "base/logging.h" 23 #include "base/logging.h"
25 #include "base/stl_util.h" 24 #include "base/stl_util.h"
26 #include "base/stringprintf.h" 25 #include "base/stringprintf.h"
27 #include "ui/aura/client/aura_constants.h" 26 #include "ui/aura/client/aura_constants.h"
28 #include "ui/aura/root_window.h" 27 #include "ui/aura/root_window.h"
29 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // won't see the animation. 317 // won't see the animation.
319 contents_view_->StackChildAtTop(active_workspace_->window()); 318 contents_view_->StackChildAtTop(active_workspace_->window());
320 } else if (active_workspace_->is_maximized() && last_active->is_maximized()) { 319 } else if (active_workspace_->is_maximized() && last_active->is_maximized()) {
321 // When switching between maximized windows we need the last active 320 // When switching between maximized windows we need the last active
322 // workspace on top of the new, otherwise the animations won't look 321 // workspace on top of the new, otherwise the animations won't look
323 // right. Since only one workspace is visible at a time stacking order of 322 // right. Since only one workspace is visible at a time stacking order of
324 // the workspace windows ultimately doesn't matter. 323 // the workspace windows ultimately doesn't matter.
325 contents_view_->StackChildAtTop(last_active->window()); 324 contents_view_->StackChildAtTop(last_active->window());
326 } 325 }
327 326
328 destroy_background_timer_.Stop();
329 if (active_workspace_ == desktop_workspace()) {
330 base::TimeDelta delay(GetSystemBackgroundDestroyDuration());
331 if (ui::LayerAnimator::slow_animation_mode())
332 delay *= ui::LayerAnimator::slow_animation_scale_factor();
333 // Delay an extra 100ms to make sure everything settles down before
334 // destroying the background.
335 delay += base::TimeDelta::FromMilliseconds(100);
336 destroy_background_timer_.Start(
337 FROM_HERE, delay, this, &WorkspaceManager2::DestroySystemBackground);
338 } else if (!background_controller_.get()) {
339 background_controller_.reset(new SystemBackgroundController(
340 contents_view_->GetRootWindow()));
341 }
342
343 UpdateShelfVisibility(); 327 UpdateShelfVisibility();
344 328
345 if (animate_type != ANIMATE_NONE) { 329 if (animate_type != ANIMATE_NONE) {
346 AnimateBetweenWorkspaces( 330 AnimateBetweenWorkspaces(
347 last_active->window(), 331 last_active->window(),
348 WorkspaceType(last_active), 332 WorkspaceType(last_active),
349 (animate_type == ANIMATE_OLD_AND_NEW), 333 (animate_type == ANIMATE_OLD_AND_NEW),
350 workspace->window(), 334 workspace->window(),
351 WorkspaceType(workspace), 335 WorkspaceType(workspace),
352 is_unminimizing_maximized_window); 336 is_unminimizing_maximized_window);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 SetActiveWorkspace(*(workspace_i - 1), animate_type); 426 SetActiveWorkspace(*(workspace_i - 1), animate_type);
443 } 427 }
444 428
445 void WorkspaceManager2::ScheduleDelete(Workspace2* workspace) { 429 void WorkspaceManager2::ScheduleDelete(Workspace2* workspace) {
446 to_delete_.insert(workspace); 430 to_delete_.insert(workspace);
447 delete_timer_.Stop(); 431 delete_timer_.Stop();
448 delete_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this, 432 delete_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
449 &WorkspaceManager2::ProcessDeletion); 433 &WorkspaceManager2::ProcessDeletion);
450 } 434 }
451 435
452 void WorkspaceManager2::DestroySystemBackground() {
453 background_controller_.reset();
454 }
455
456 void WorkspaceManager2::SetUnminimizingWorkspace(Workspace2* workspace) { 436 void WorkspaceManager2::SetUnminimizingWorkspace(Workspace2* workspace) {
457 // The normal sequence of unminimizing a window is: Show() the window, which 437 // The normal sequence of unminimizing a window is: Show() the window, which
458 // triggers changing the kShowStateKey to NORMAL and lastly the window is made 438 // triggers changing the kShowStateKey to NORMAL and lastly the window is made
459 // active. This means at the time the window is unminimized we don't know if 439 // active. This means at the time the window is unminimized we don't know if
460 // the workspace it is in is going to become active. To track this 440 // the workspace it is in is going to become active. To track this
461 // |unminimizing_workspace_| is set at the time we unminimize and a task is 441 // |unminimizing_workspace_| is set at the time we unminimize and a task is
462 // schedule to reset it. This way when we get the activate we know we're in 442 // schedule to reset it. This way when we get the activate we know we're in
463 // the process unminimizing and can do the right animation. 443 // the process unminimizing and can do the right animation.
464 unminimizing_workspace_ = workspace; 444 unminimizing_workspace_ = workspace;
465 if (unminimizing_workspace_) { 445 if (unminimizing_workspace_) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 const bool is_active = wm::IsActiveWindow(window); 588 const bool is_active = wm::IsActiveWindow(window);
609 if (is_active) 589 if (is_active)
610 new_workspace->window()->Show(); 590 new_workspace->window()->Show();
611 ReparentWindow(window, new_workspace->window(), NULL); 591 ReparentWindow(window, new_workspace->window(), NULL);
612 if (is_active) 592 if (is_active)
613 SetActiveWorkspace(new_workspace, ANIMATE_OLD_AND_NEW); 593 SetActiveWorkspace(new_workspace, ANIMATE_OLD_AND_NEW);
614 } 594 }
615 595
616 } // namespace internal 596 } // namespace internal
617 } // namespace ash 597 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager2.h ('k') | chrome/browser/ui/ash/chrome_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698