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

Side by Side Diff: ash/common/wallpaper/wallpaper_widget_controller.cc

Issue 2620153003: Folds WmRootWindowController into RootWindowController (Closed)
Patch Set: merge Created 3 years, 11 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/common/wallpaper/wallpaper_widget_controller.h ('k') | ash/common/wm/container_finder.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/common/wallpaper/wallpaper_widget_controller.h" 5 #include "ash/common/wallpaper/wallpaper_widget_controller.h"
6 6
7 #include "ash/ash_export.h" 7 #include "ash/ash_export.h"
8 #include "ash/common/wallpaper/wallpaper_delegate.h" 8 #include "ash/common/wallpaper/wallpaper_delegate.h"
9 #include "ash/common/wm_lookup.h" 9 #include "ash/common/wm_lookup.h"
10 #include "ash/common/wm_root_window_controller.h"
11 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
12 #include "ash/common/wm_window.h" 11 #include "ash/common/wm_window.h"
12 #include "ash/root_window_controller.h"
13 #include "ui/compositor/layer_animation_observer.h" 13 #include "ui/compositor/layer_animation_observer.h"
14 #include "ui/compositor/scoped_layer_animation_settings.h" 14 #include "ui/compositor/scoped_layer_animation_settings.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace ash { 17 namespace ash {
18 namespace { 18 namespace {
19 19
20 class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver, 20 class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver,
21 public views::WidgetObserver { 21 public views::WidgetObserver {
22 public: 22 public:
23 ShowWallpaperAnimationObserver(WmRootWindowController* root_window_controller, 23 ShowWallpaperAnimationObserver(RootWindowController* root_window_controller,
24 views::Widget* wallpaper_widget, 24 views::Widget* wallpaper_widget,
25 bool is_initial_animation) 25 bool is_initial_animation)
26 : root_window_controller_(root_window_controller), 26 : root_window_controller_(root_window_controller),
27 wallpaper_widget_(wallpaper_widget), 27 wallpaper_widget_(wallpaper_widget),
28 is_initial_animation_(is_initial_animation) { 28 is_initial_animation_(is_initial_animation) {
29 DCHECK(wallpaper_widget_); 29 DCHECK(wallpaper_widget_);
30 wallpaper_widget_->AddObserver(this); 30 wallpaper_widget_->AddObserver(this);
31 } 31 }
32 32
33 ~ShowWallpaperAnimationObserver() override { 33 ~ShowWallpaperAnimationObserver() override {
(...skipping 10 matching lines...) Expand all
44 } 44 }
45 45
46 void OnImplicitAnimationsCompleted() override { 46 void OnImplicitAnimationsCompleted() override {
47 root_window_controller_->OnWallpaperAnimationFinished(wallpaper_widget_); 47 root_window_controller_->OnWallpaperAnimationFinished(wallpaper_widget_);
48 delete this; 48 delete this;
49 } 49 }
50 50
51 // Overridden from views::WidgetObserver. 51 // Overridden from views::WidgetObserver.
52 void OnWidgetDestroying(views::Widget* widget) override { delete this; } 52 void OnWidgetDestroying(views::Widget* widget) override { delete this; }
53 53
54 WmRootWindowController* root_window_controller_; 54 RootWindowController* root_window_controller_;
55 views::Widget* wallpaper_widget_; 55 views::Widget* wallpaper_widget_;
56 56
57 // Is this object observing the initial brightness/grayscale animation? 57 // Is this object observing the initial brightness/grayscale animation?
58 const bool is_initial_animation_; 58 const bool is_initial_animation_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver); 60 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver);
61 }; 61 };
62 62
63 } // namespace 63 } // namespace
64 64
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 void WallpaperWidgetController::OnWindowBoundsChanged( 109 void WallpaperWidgetController::OnWindowBoundsChanged(
110 WmWindow* window, 110 WmWindow* window,
111 const gfx::Rect& old_bounds, 111 const gfx::Rect& old_bounds,
112 const gfx::Rect& new_bounds) { 112 const gfx::Rect& new_bounds) {
113 SetBounds(new_bounds); 113 SetBounds(new_bounds);
114 } 114 }
115 115
116 void WallpaperWidgetController::StartAnimating( 116 void WallpaperWidgetController::StartAnimating(
117 WmRootWindowController* root_window_controller) { 117 RootWindowController* root_window_controller) {
118 if (widget_) { 118 if (widget_) {
119 ui::ScopedLayerAnimationSettings settings( 119 ui::ScopedLayerAnimationSettings settings(
120 widget_->GetLayer()->GetAnimator()); 120 widget_->GetLayer()->GetAnimator());
121 settings.AddObserver(new ShowWallpaperAnimationObserver( 121 settings.AddObserver(new ShowWallpaperAnimationObserver(
122 root_window_controller, widget_, 122 root_window_controller, widget_,
123 WmShell::Get()->wallpaper_delegate()->ShouldShowInitialAnimation())); 123 WmShell::Get()->wallpaper_delegate()->ShouldShowInitialAnimation()));
124 // When |widget_| shows, AnimateShowWindowCommon() is called to do the 124 // When |widget_| shows, AnimateShowWindowCommon() is called to do the
125 // animation. Sets transition duration to 0 to avoid animating to the 125 // animation. Sets transition duration to 0 to avoid animating to the
126 // show animation's initial values. 126 // show animation's initial values.
127 settings.SetTransitionDuration(base::TimeDelta()); 127 settings.SetTransitionDuration(base::TimeDelta());
(...skipping 13 matching lines...) Expand all
141 } 141 }
142 142
143 WallpaperWidgetController* AnimatingWallpaperWidgetController::GetController( 143 WallpaperWidgetController* AnimatingWallpaperWidgetController::GetController(
144 bool pass_ownership) { 144 bool pass_ownership) {
145 if (pass_ownership) 145 if (pass_ownership)
146 return controller_.release(); 146 return controller_.release();
147 return controller_.get(); 147 return controller_.get();
148 } 148 }
149 149
150 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wallpaper/wallpaper_widget_controller.h ('k') | ash/common/wm/container_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698