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

Side by Side Diff: ash/wm/workspace_controller.cc

Issue 98373006: Animating docked background in sync with shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Animating docked background in sync with shelf (rebase) Created 7 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 unified diff | Download patch
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('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_controller.h" 5 #include "ash/wm/workspace_controller.h"
6 6
7 #include "ash/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/base_layout_manager.h" 10 #include "ash/wm/base_layout_manager.h"
(...skipping 12 matching lines...) Expand all
23 #include "ui/views/corewm/window_animations.h" 23 #include "ui/views/corewm/window_animations.h"
24 24
25 namespace ash { 25 namespace ash {
26 namespace internal { 26 namespace internal {
27 namespace { 27 namespace {
28 28
29 // Amount of time to pause before animating anything. Only used during initial 29 // Amount of time to pause before animating anything. Only used during initial
30 // animation (when logging in). 30 // animation (when logging in).
31 const int kInitialPauseTimeMS = 750; 31 const int kInitialPauseTimeMS = 750;
32 32
33 // Returns true if the |window| is docked and visible.
34 bool IsDockedAndVisible(const aura::Window* window) {
35 return (window->parent()->id() == kShellWindowId_DockedContainer &&
36 window->IsVisible() &&
37 !wm::GetWindowState(window)->IsMinimized() &&
38 window->type() != aura::client::WINDOW_TYPE_POPUP &&
39 !window->transient_parent());
40 }
41
33 } // namespace 42 } // namespace
34 43
35 WorkspaceController::WorkspaceController(aura::Window* viewport) 44 WorkspaceController::WorkspaceController(aura::Window* viewport)
36 : viewport_(viewport), 45 : viewport_(viewport),
37 shelf_(NULL), 46 shelf_(NULL),
38 event_handler_(new WorkspaceEventHandler(viewport_)) { 47 event_handler_(new WorkspaceEventHandler(viewport_)) {
39 SetWindowVisibilityAnimationTransition( 48 SetWindowVisibilityAnimationTransition(
40 viewport_, views::corewm::ANIMATE_NONE); 49 viewport_, views::corewm::ANIMATE_NONE);
41 50
42 // The layout-manager cannot be created in the initializer list since it 51 // The layout-manager cannot be created in the initializer list since it
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ui::Layer* layer = (*i)->layer(); 88 ui::Layer* layer = (*i)->layer();
80 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) 89 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f)
81 continue; 90 continue;
82 if (window_state->IsMaximized()) { 91 if (window_state->IsMaximized()) {
83 // An untracked window may still be fullscreen so we keep iterating when 92 // An untracked window may still be fullscreen so we keep iterating when
84 // we hit a maximized window. 93 // we hit a maximized window.
85 has_maximized_window = true; 94 has_maximized_window = true;
86 } else if (window_state->IsFullscreen()) { 95 } else if (window_state->IsFullscreen()) {
87 return WORKSPACE_WINDOW_STATE_FULL_SCREEN; 96 return WORKSPACE_WINDOW_STATE_FULL_SCREEN;
88 } 97 }
89 if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds)) 98 if (!window_overlaps_launcher &&
99 ((*i)->bounds().Intersects(shelf_bounds) ||
100 IsDockedAndVisible(*i))) {
90 window_overlaps_launcher = true; 101 window_overlaps_launcher = true;
102 }
91 } 103 }
92 } 104 }
93 if (has_maximized_window) 105 if (has_maximized_window)
94 return WORKSPACE_WINDOW_STATE_MAXIMIZED; 106 return WORKSPACE_WINDOW_STATE_MAXIMIZED;
95 107
96 return window_overlaps_launcher ? 108 return window_overlaps_launcher ?
97 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : 109 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF :
98 WORKSPACE_WINDOW_STATE_DEFAULT; 110 WORKSPACE_WINDOW_STATE_DEFAULT;
99 } 111 }
100 112
(...skipping 28 matching lines...) Expand all
129 settings.SetTweenType(gfx::Tween::EASE_OUT); 141 settings.SetTweenType(gfx::Tween::EASE_OUT);
130 settings.SetTransitionDuration( 142 settings.SetTransitionDuration(
131 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 143 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
132 viewport_->layer()->SetTransform(gfx::Transform()); 144 viewport_->layer()->SetTransform(gfx::Transform());
133 viewport_->layer()->SetOpacity(1.0f); 145 viewport_->layer()->SetOpacity(1.0f);
134 } 146 }
135 } 147 }
136 148
137 } // namespace internal 149 } // namespace internal
138 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698