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

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

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 years, 8 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_view.h" 5 #include "ash/desktop_background/desktop_background_view.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/desktop_background/user_wallpaper_delegate.h" 12 #include "ash/desktop_background/user_wallpaper_delegate.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/session_state_delegate.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/shell_delegate.h"
16 #include "ash/shell_window_ids.h" 16 #include "ash/shell_window_ids.h"
17 #include "ash/wm/property_util.h" 17 #include "ash/wm/property_util.h"
18 #include "ash/wm/window_animations.h" 18 #include "ash/wm/window_animations.h"
19 #include "base/message_loop.h" 19 #include "base/message_loop.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "ui/aura/root_window.h" 21 #include "ui/aura/root_window.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
24 #include "ui/compositor/layer_animation_observer.h" 24 #include "ui/compositor/layer_animation_observer.h"
25 #include "ui/compositor/scoped_layer_animation_settings.h" 25 #include "ui/compositor/scoped_layer_animation_settings.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 views::corewm::SetWindowVisibilityAnimationType( 194 views::corewm::SetWindowVisibilityAnimationType(
195 desktop_widget->GetNativeView(), animation_type); 195 desktop_widget->GetNativeView(), animation_type);
196 196
197 // Enable wallpaper transition for the following cases: 197 // Enable wallpaper transition for the following cases:
198 // 1. Initial(OOBE) wallpaper animation. 198 // 1. Initial(OOBE) wallpaper animation.
199 // 2. Wallpaper fades in from a non empty background. 199 // 2. Wallpaper fades in from a non empty background.
200 // 3. From an empty background, chrome transit to a logged in user session. 200 // 3. From an empty background, chrome transit to a logged in user session.
201 // 4. From an empty background, guest user logged in. 201 // 4. From an empty background, guest user logged in.
202 if (wallpaper_delegate->ShouldShowInitialAnimation() || 202 if (wallpaper_delegate->ShouldShowInitialAnimation() ||
203 root_window->GetProperty(kAnimatingDesktopController) || 203 root_window->GetProperty(kAnimatingDesktopController) ||
204 Shell::GetInstance()->delegate()->IsGuestSession() || 204 Shell::GetInstance()->session_state_delegate()->HasActiveUser()) {
205 Shell::GetInstance()->delegate()->IsUserLoggedIn()) {
206 views::corewm::SetWindowVisibilityAnimationTransition( 205 views::corewm::SetWindowVisibilityAnimationTransition(
207 desktop_widget->GetNativeView(), views::corewm::ANIMATE_SHOW); 206 desktop_widget->GetNativeView(), views::corewm::ANIMATE_SHOW);
208 } else { 207 } else {
209 // Disable animation if transition to login screen from an empty background. 208 // Disable animation if transition to login screen from an empty background.
210 views::corewm::SetWindowVisibilityAnimationTransition( 209 views::corewm::SetWindowVisibilityAnimationTransition(
211 desktop_widget->GetNativeView(), views::corewm::ANIMATE_NONE); 210 desktop_widget->GetNativeView(), views::corewm::ANIMATE_NONE);
212 } 211 }
213 212
214 desktop_widget->SetBounds(params.parent->bounds()); 213 desktop_widget->SetBounds(params.parent->bounds());
215 ui::ScopedLayerAnimationSettings settings( 214 ui::ScopedLayerAnimationSettings settings(
216 desktop_widget->GetNativeView()->layer()->GetAnimator()); 215 desktop_widget->GetNativeView()->layer()->GetAnimator());
217 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); 216 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
218 settings.AddObserver(new ShowWallpaperAnimationObserver( 217 settings.AddObserver(new ShowWallpaperAnimationObserver(
219 root_window, desktop_widget, 218 root_window, desktop_widget,
220 wallpaper_delegate->ShouldShowInitialAnimation())); 219 wallpaper_delegate->ShouldShowInitialAnimation()));
221 desktop_widget->Show(); 220 desktop_widget->Show();
222 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView"); 221 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView");
223 return desktop_widget; 222 return desktop_widget;
224 } 223 }
225 224
226 } // namespace internal 225 } // namespace internal
227 } // namespace ash 226 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698