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

Side by Side Diff: ash/desktop_background/desktop_background_widget_controller.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests 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
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/wm_lookup.h" 8 #include "ash/common/wm_lookup.h"
9 #include "ash/common/wm/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"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
15 #include "ui/compositor/layer_animation_observer.h" 15 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/compositor/scoped_layer_animation_settings.h" 16 #include "ui/compositor/scoped_layer_animation_settings.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 #include "ui/views/widget/widget_observer.h" 18 #include "ui/views/widget/widget_observer.h"
19 19
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const bool is_initial_animation_; 63 const bool is_initial_animation_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver); 65 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver);
66 }; 66 };
67 67
68 } // namespace 68 } // namespace
69 69
70 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController( 70 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
71 views::Widget* widget) 71 views::Widget* widget)
72 : widget_(widget), 72 : widget_(widget),
73 widget_parent_( 73 widget_parent_(WmLookup::Get()->GetWindowForWidget(widget)->GetParent()) {
74 wm::WmLookup::Get()->GetWindowForWidget(widget)->GetParent()) {
75 DCHECK(widget_); 74 DCHECK(widget_);
76 widget_->AddObserver(this); 75 widget_->AddObserver(this);
77 widget_parent_->AddObserver(this); 76 widget_parent_->AddObserver(this);
78 } 77 }
79 78
80 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() { 79 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
81 if (widget_) { 80 if (widget_) {
82 views::Widget* widget = widget_; 81 views::Widget* widget = widget_;
83 RemoveObservers(); 82 RemoveObservers();
84 widget->CloseNow(); 83 widget->CloseNow();
(...skipping 10 matching lines...) Expand all
95 widget_->SetBounds(bounds); 94 widget_->SetBounds(bounds);
96 } 95 }
97 96
98 bool DesktopBackgroundWidgetController::Reparent(aura::Window* root_window, 97 bool DesktopBackgroundWidgetController::Reparent(aura::Window* root_window,
99 int src_container, 98 int src_container,
100 int dest_container) { 99 int dest_container) {
101 if (widget_) { 100 if (widget_) {
102 widget_parent_->RemoveObserver(this); 101 widget_parent_->RemoveObserver(this);
103 views::Widget::ReparentNativeView(widget_->GetNativeView(), 102 views::Widget::ReparentNativeView(widget_->GetNativeView(),
104 root_window->GetChildById(dest_container)); 103 root_window->GetChildById(dest_container));
105 widget_parent_ = 104 widget_parent_ = WmLookup::Get()->GetWindowForWidget(widget_)->GetParent();
106 wm::WmLookup::Get()->GetWindowForWidget(widget_)->GetParent();
107 widget_parent_->AddObserver(this); 105 widget_parent_->AddObserver(this);
108 return true; 106 return true;
109 } 107 }
110 // Nothing to reparent. 108 // Nothing to reparent.
111 return false; 109 return false;
112 } 110 }
113 111
114 void DesktopBackgroundWidgetController::RemoveObservers() { 112 void DesktopBackgroundWidgetController::RemoveObservers() {
115 widget_parent_->RemoveObserver(this); 113 widget_parent_->RemoveObserver(this);
116 widget_->RemoveObserver(this); 114 widget_->RemoveObserver(this);
117 widget_ = nullptr; 115 widget_ = nullptr;
118 } 116 }
119 117
120 void DesktopBackgroundWidgetController::OnWindowBoundsChanged( 118 void DesktopBackgroundWidgetController::OnWindowBoundsChanged(
121 wm::WmWindow* window, 119 WmWindow* window,
122 const gfx::Rect& old_bounds, 120 const gfx::Rect& old_bounds,
123 const gfx::Rect& new_bounds) { 121 const gfx::Rect& new_bounds) {
124 SetBounds(new_bounds); 122 SetBounds(new_bounds);
125 } 123 }
126 124
127 void DesktopBackgroundWidgetController::StartAnimating( 125 void DesktopBackgroundWidgetController::StartAnimating(
128 RootWindowController* root_window_controller) { 126 RootWindowController* root_window_controller) {
129 if (widget_) { 127 if (widget_) {
130 ui::ScopedLayerAnimationSettings settings( 128 ui::ScopedLayerAnimationSettings settings(
131 widget_->GetNativeView()->layer()->GetAnimator()); 129 widget_->GetNativeView()->layer()->GetAnimator());
(...skipping 25 matching lines...) Expand all
157 } 155 }
158 156
159 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( 157 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController(
160 bool pass_ownership) { 158 bool pass_ownership) {
161 if (pass_ownership) 159 if (pass_ownership)
162 return controller_.release(); 160 return controller_.release();
163 return controller_.get(); 161 return controller_.get();
164 } 162 }
165 163
166 } // namespace ash 164 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698