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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 <utility> 7 #include <utility>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } // namespace 45 } // namespace
46 46
47 WorkspaceController::WorkspaceController( 47 WorkspaceController::WorkspaceController(
48 aura::Window* viewport, 48 aura::Window* viewport,
49 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate) 49 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate)
50 : viewport_(viewport), 50 : viewport_(viewport),
51 shelf_(NULL), 51 shelf_(NULL),
52 event_handler_(new WorkspaceEventHandler), 52 event_handler_(new WorkspaceEventHandler),
53 layout_manager_(new WorkspaceLayoutManager(WmWindowAura::Get(viewport), 53 layout_manager_(new WorkspaceLayoutManager(WmWindowAura::Get(viewport),
54 std::move(delegate))) { 54 std::move(delegate))) {
55 SetWindowVisibilityAnimationTransition( 55 SetWindowVisibilityAnimationTransition(viewport_, ::wm::ANIMATE_NONE);
56 viewport_, ::wm::ANIMATE_NONE);
57 56
58 WmWindowAura::Get(viewport_)->SetLayoutManager( 57 WmWindowAura::Get(viewport_)->SetLayoutManager(
59 base::WrapUnique(layout_manager_)); 58 base::WrapUnique(layout_manager_));
60 viewport_->AddPreTargetHandler(event_handler_.get()); 59 viewport_->AddPreTargetHandler(event_handler_.get());
61 } 60 }
62 61
63 WorkspaceController::~WorkspaceController() { 62 WorkspaceController::~WorkspaceController() {
64 viewport_->SetLayoutManager(NULL); 63 viewport_->SetLayoutManager(NULL);
65 viewport_->RemovePreTargetHandler(event_handler_.get()); 64 viewport_->RemovePreTargetHandler(event_handler_.get());
66 } 65 }
67 66
68 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const { 67 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const {
69 if (!shelf_) 68 if (!shelf_)
70 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; 69 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
71 const aura::Window* topmost_fullscreen_window = GetRootWindowController( 70 const aura::Window* topmost_fullscreen_window =
72 viewport_->GetRootWindow())->GetWindowForFullscreenMode(); 71 GetRootWindowController(viewport_->GetRootWindow())
72 ->GetWindowForFullscreenMode();
73 if (topmost_fullscreen_window && 73 if (topmost_fullscreen_window &&
74 !wm::GetWindowState(topmost_fullscreen_window)->ignored_by_shelf()) { 74 !wm::GetWindowState(topmost_fullscreen_window)->ignored_by_shelf()) {
75 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; 75 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN;
76 } 76 }
77 77
78 // These are the container ids of containers which may contain windows that 78 // These are the container ids of containers which may contain windows that
79 // may overlap the launcher shelf and affect its transparency. 79 // may overlap the launcher shelf and affect its transparency.
80 const int kWindowContainerIds[] = {kShellWindowId_DefaultContainer, 80 const int kWindowContainerIds[] = {
81 kShellWindowId_DockedContainer, }; 81 kShellWindowId_DefaultContainer, kShellWindowId_DockedContainer,
82 };
82 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds()); 83 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds());
83 bool window_overlaps_launcher = false; 84 bool window_overlaps_launcher = false;
84 for (size_t idx = 0; idx < arraysize(kWindowContainerIds); idx++) { 85 for (size_t idx = 0; idx < arraysize(kWindowContainerIds); idx++) {
85 const aura::Window* container = Shell::GetContainer( 86 const aura::Window* container = Shell::GetContainer(
86 viewport_->GetRootWindow(), kWindowContainerIds[idx]); 87 viewport_->GetRootWindow(), kWindowContainerIds[idx]);
87 const aura::Window::Windows& windows(container->children()); 88 const aura::Window::Windows& windows(container->children());
88 for (aura::Window::Windows::const_iterator i = windows.begin(); 89 for (aura::Window::Windows::const_iterator i = windows.begin();
89 i != windows.end(); ++i) { 90 i != windows.end(); ++i) {
90 wm::WindowState* window_state = wm::GetWindowState(*i); 91 wm::WindowState* window_state = wm::GetWindowState(*i);
91 if (window_state->ignored_by_shelf()) 92 if (window_state->ignored_by_shelf())
(...skipping 17 matching lines...) Expand all
109 } 110 }
110 111
111 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) { 112 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) {
112 shelf_ = shelf; 113 shelf_ = shelf;
113 } 114 }
114 115
115 void WorkspaceController::DoInitialAnimation() { 116 void WorkspaceController::DoInitialAnimation() {
116 viewport_->Show(); 117 viewport_->Show();
117 118
118 viewport_->layer()->SetOpacity(0.0f); 119 viewport_->layer()->SetOpacity(0.0f);
119 SetTransformForScaleAnimation( 120 SetTransformForScaleAnimation(viewport_->layer(),
120 viewport_->layer(), LAYER_SCALE_ANIMATION_ABOVE); 121 LAYER_SCALE_ANIMATION_ABOVE);
121 122
122 // In order for pause to work we need to stop animations. 123 // In order for pause to work we need to stop animations.
123 viewport_->layer()->GetAnimator()->StopAnimating(); 124 viewport_->layer()->GetAnimator()->StopAnimating();
124 125
125 { 126 {
126 ui::ScopedLayerAnimationSettings settings( 127 ui::ScopedLayerAnimationSettings settings(
127 viewport_->layer()->GetAnimator()); 128 viewport_->layer()->GetAnimator());
128 129
129 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); 130 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
130 viewport_->layer()->GetAnimator()->SchedulePauseForProperties( 131 viewport_->layer()->GetAnimator()->SchedulePauseForProperties(
131 base::TimeDelta::FromMilliseconds(kInitialPauseTimeMS), 132 base::TimeDelta::FromMilliseconds(kInitialPauseTimeMS),
132 ui::LayerAnimationElement::TRANSFORM | 133 ui::LayerAnimationElement::TRANSFORM |
133 ui::LayerAnimationElement::OPACITY | 134 ui::LayerAnimationElement::OPACITY |
134 ui::LayerAnimationElement::BRIGHTNESS | 135 ui::LayerAnimationElement::BRIGHTNESS |
135 ui::LayerAnimationElement::VISIBILITY); 136 ui::LayerAnimationElement::VISIBILITY);
136 settings.SetTweenType(gfx::Tween::EASE_OUT); 137 settings.SetTweenType(gfx::Tween::EASE_OUT);
137 settings.SetTransitionDuration( 138 settings.SetTransitionDuration(
138 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); 139 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS));
139 viewport_->layer()->SetTransform(gfx::Transform()); 140 viewport_->layer()->SetTransform(gfx::Transform());
140 viewport_->layer()->SetOpacity(1.0f); 141 viewport_->layer()->SetOpacity(1.0f);
141 } 142 }
142 } 143 }
143 144
144 void WorkspaceController::SetMaximizeBackdropDelegate( 145 void WorkspaceController::SetMaximizeBackdropDelegate(
145 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) { 146 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) {
146 layout_manager_->SetMaximizeBackdropDelegate(std::move(delegate)); 147 layout_manager_->SetMaximizeBackdropDelegate(std::move(delegate));
147 } 148 }
148 149
149 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer_unittest.cc ('k') | ash/wm/workspace_controller_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698