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

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

Issue 10854136: Revert 151393 - Fix white flash when user signs out and fix wallpaper animation regression (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/views/widget/widget.h" 8 #include "ui/views/widget/widget.h"
9 9
10 DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*); 10 DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*);
11 DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::ComponentWrapper*);
12 11
13 namespace ash { 12 namespace ash {
14 namespace internal { 13 namespace internal {
15 14
16 DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController, 15 DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController,
17 kWindowDesktopComponent, NULL); 16 kWindowDesktopComponent, NULL);
18 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ComponentWrapper, kComponentWrapper, NULL);
19 17
20 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController( 18 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
21 views::Widget* widget) : widget_(widget) { 19 views::Widget* widget) : widget_(widget) {
22 } 20 }
23 21
24 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController( 22 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
25 ui::Layer* layer) : widget_(NULL) { 23 ui::Layer* layer) : widget_(NULL) {
26 layer_.reset(layer); 24 layer_.reset(layer);
27 } 25 }
28 26
29 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() { 27 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
30 if (widget_) { 28 if (widget_) {
31 widget_->CloseNow(); 29 widget_->CloseNow();
32 widget_ = NULL; 30 widget_ = NULL;
33 } else if (layer_.get()) 31 } else if (layer_.get())
34 layer_.reset(NULL); 32 layer_.reset(NULL);
35 } 33 }
36 34
37 void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) { 35 void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
38 if (widget_) 36 if (widget_)
39 widget_->SetBounds(bounds); 37 widget_->SetBounds(bounds);
40 else if (layer_.get()) 38 else if (layer_.get())
41 layer_->SetBounds(bounds); 39 layer_->SetBounds(bounds);
42 } 40 }
43 41
42
44 void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window, 43 void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
45 int src_container, 44 int src_container,
46 int dest_container) { 45 int dest_container) {
47 if (widget_) { 46 if (widget_) {
48 views::Widget::ReparentNativeView(widget_->GetNativeView(), 47 views::Widget::ReparentNativeView(widget_->GetNativeView(),
49 root_window->GetChildById(dest_container)); 48 root_window->GetChildById(dest_container));
50 } else if (layer_.get()) { 49 } else if (layer_.get()) {
51 ui::Layer* layer = layer_.get(); 50 ui::Layer* layer = layer_.get();
52 root_window->GetChildById(src_container)->layer()->Remove(layer); 51 root_window->GetChildById(src_container)->layer()->Remove(layer);
53 root_window->GetChildById(dest_container)->layer()->Add(layer); 52 root_window->GetChildById(dest_container)->layer()->Add(layer);
54 } 53 }
55 } 54 }
56 55
57 ComponentWrapper::ComponentWrapper(
58 DesktopBackgroundWidgetController* component) : component_(component) {
59 }
60
61 } // namespace internal 56 } // namespace internal
62 } // namespace ash 57 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_widget_controller.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698