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

Side by Side Diff: ash/desktop_background/desktop_background_widget_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, 6 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
« no previous file with comments | « ash/desktop_background/desktop_background_view.cc ('k') | ash/dip_unittest.cc » ('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/desktop_background/desktop_background_widget_controller.h" 5 #include "ash/desktop_background/desktop_background_widget_controller.h"
6 6
7 #include "ash/ash_export.h" 7 #include "ash/ash_export.h"
8 #include "ash/common/wm_lookup.h" 8 #include "ash/common/wm_lookup.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/desktop_background/user_wallpaper_delegate.h" 10 #include "ash/desktop_background/user_wallpaper_delegate.h"
(...skipping 25 matching lines...) Expand all
36 ~ShowWallpaperAnimationObserver() override { 36 ~ShowWallpaperAnimationObserver() override {
37 StopObservingImplicitAnimations(); 37 StopObservingImplicitAnimations();
38 if (desktop_widget_) 38 if (desktop_widget_)
39 desktop_widget_->RemoveObserver(this); 39 desktop_widget_->RemoveObserver(this);
40 } 40 }
41 41
42 private: 42 private:
43 // Overridden from ui::ImplicitAnimationObserver: 43 // Overridden from ui::ImplicitAnimationObserver:
44 void OnImplicitAnimationsScheduled() override { 44 void OnImplicitAnimationsScheduled() override {
45 if (is_initial_animation_) { 45 if (is_initial_animation_) {
46 root_window_controller_-> 46 root_window_controller_->HandleInitialDesktopBackgroundAnimationStarted();
47 HandleInitialDesktopBackgroundAnimationStarted();
48 } 47 }
49 } 48 }
50 49
51 void OnImplicitAnimationsCompleted() override { 50 void OnImplicitAnimationsCompleted() override {
52 root_window_controller_->OnWallpaperAnimationFinished(desktop_widget_); 51 root_window_controller_->OnWallpaperAnimationFinished(desktop_widget_);
53 delete this; 52 delete this;
54 } 53 }
55 54
56 // Overridden from views::WidgetObserver. 55 // Overridden from views::WidgetObserver.
57 void OnWidgetDestroying(views::Widget* widget) override { delete this; } 56 void OnWidgetDestroying(views::Widget* widget) override { delete this; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void DesktopBackgroundWidgetController::SetBounds(const gfx::Rect& bounds) { 91 void DesktopBackgroundWidgetController::SetBounds(const gfx::Rect& bounds) {
93 if (widget_) 92 if (widget_)
94 widget_->SetBounds(bounds); 93 widget_->SetBounds(bounds);
95 } 94 }
96 95
97 bool DesktopBackgroundWidgetController::Reparent(aura::Window* root_window, 96 bool DesktopBackgroundWidgetController::Reparent(aura::Window* root_window,
98 int src_container, 97 int src_container,
99 int dest_container) { 98 int dest_container) {
100 if (widget_) { 99 if (widget_) {
101 widget_parent_->RemoveObserver(this); 100 widget_parent_->RemoveObserver(this);
102 views::Widget::ReparentNativeView(widget_->GetNativeView(), 101 views::Widget::ReparentNativeView(
103 root_window->GetChildById(dest_container)); 102 widget_->GetNativeView(), root_window->GetChildById(dest_container));
104 widget_parent_ = WmLookup::Get()->GetWindowForWidget(widget_)->GetParent(); 103 widget_parent_ = WmLookup::Get()->GetWindowForWidget(widget_)->GetParent();
105 widget_parent_->AddObserver(this); 104 widget_parent_->AddObserver(this);
106 return true; 105 return true;
107 } 106 }
108 // Nothing to reparent. 107 // Nothing to reparent.
109 return false; 108 return false;
110 } 109 }
111 110
112 void DesktopBackgroundWidgetController::RemoveObservers() { 111 void DesktopBackgroundWidgetController::RemoveObservers() {
113 widget_parent_->RemoveObserver(this); 112 widget_parent_->RemoveObserver(this);
114 widget_->RemoveObserver(this); 113 widget_->RemoveObserver(this);
115 widget_ = nullptr; 114 widget_ = nullptr;
116 } 115 }
117 116
118 void DesktopBackgroundWidgetController::OnWindowBoundsChanged( 117 void DesktopBackgroundWidgetController::OnWindowBoundsChanged(
119 WmWindow* window, 118 WmWindow* window,
120 const gfx::Rect& old_bounds, 119 const gfx::Rect& old_bounds,
121 const gfx::Rect& new_bounds) { 120 const gfx::Rect& new_bounds) {
122 SetBounds(new_bounds); 121 SetBounds(new_bounds);
123 } 122 }
124 123
125 void DesktopBackgroundWidgetController::StartAnimating( 124 void DesktopBackgroundWidgetController::StartAnimating(
126 RootWindowController* root_window_controller) { 125 RootWindowController* root_window_controller) {
127 if (widget_) { 126 if (widget_) {
128 ui::ScopedLayerAnimationSettings settings( 127 ui::ScopedLayerAnimationSettings settings(
129 widget_->GetNativeView()->layer()->GetAnimator()); 128 widget_->GetNativeView()->layer()->GetAnimator());
130 settings.AddObserver(new ShowWallpaperAnimationObserver( 129 settings.AddObserver(new ShowWallpaperAnimationObserver(
131 root_window_controller, widget_, 130 root_window_controller, widget_, Shell::GetInstance()
132 Shell::GetInstance()->user_wallpaper_delegate()-> 131 ->user_wallpaper_delegate()
133 ShouldShowInitialAnimation())); 132 ->ShouldShowInitialAnimation()));
134 // When |widget_| shows, AnimateShowWindowCommon() is called to do the 133 // When |widget_| shows, AnimateShowWindowCommon() is called to do the
135 // animation. Sets transition duration to 0 to avoid animating to the 134 // animation. Sets transition duration to 0 to avoid animating to the
136 // show animation's initial values. 135 // show animation's initial values.
137 settings.SetTransitionDuration(base::TimeDelta()); 136 settings.SetTransitionDuration(base::TimeDelta());
138 widget_->Show(); 137 widget_->Show();
139 } 138 }
140 } 139 }
141 140
142 AnimatingDesktopController::AnimatingDesktopController( 141 AnimatingDesktopController::AnimatingDesktopController(
143 DesktopBackgroundWidgetController* component) { 142 DesktopBackgroundWidgetController* component) {
144 controller_.reset(component); 143 controller_.reset(component);
145 } 144 }
146 145
147 AnimatingDesktopController::~AnimatingDesktopController() { 146 AnimatingDesktopController::~AnimatingDesktopController() {}
148 }
149 147
150 void AnimatingDesktopController::StopAnimating() { 148 void AnimatingDesktopController::StopAnimating() {
151 if (controller_) { 149 if (controller_) {
152 ui::Layer* layer = controller_->widget()->GetNativeView()->layer(); 150 ui::Layer* layer = controller_->widget()->GetNativeView()->layer();
153 layer->GetAnimator()->StopAnimating(); 151 layer->GetAnimator()->StopAnimating();
154 } 152 }
155 } 153 }
156 154
157 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( 155 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController(
158 bool pass_ownership) { 156 bool pass_ownership) {
159 if (pass_ownership) 157 if (pass_ownership)
160 return controller_.release(); 158 return controller_.release();
161 return controller_.get(); 159 return controller_.get();
162 } 160 }
163 161
164 } // namespace ash 162 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_view.cc ('k') | ash/dip_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698