OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ash/desktop_background/desktop_background_component.h" | |
6 | |
7 #include "ui/aura/root_window.h" | |
8 #include "ui/views/widget/widget.h" | |
9 | |
10 DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundComponent*); | |
11 | |
12 namespace ash { | |
13 namespace internal { | |
14 | |
15 DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundComponent, | |
16 kWindowDesktopComponent, NULL); | |
17 | |
18 DesktopBackgroundComponent::DesktopBackgroundComponent(views::Widget* widget) | |
19 : widget_(widget) { | |
20 } | |
21 | |
22 DesktopBackgroundComponent::DesktopBackgroundComponent(ui::Layer* layer) | |
23 : widget_(NULL) { | |
24 layer_.reset(layer); | |
25 } | |
26 | |
27 | |
28 DesktopBackgroundComponent::~DesktopBackgroundComponent() { | |
29 if (widget_) { | |
30 widget_->CloseNow(); | |
31 widget_ = NULL; | |
32 } | |
33 if (layer_.get()) { | |
Nikita (slow)
2012/07/25 20:45:24
nit: no need for {}
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Done.
| |
34 layer_.reset(NULL); | |
35 } | |
36 } | |
37 | |
38 void DesktopBackgroundComponent::SetBounds(gfx::Rect bounds) { | |
39 if (widget_) | |
40 widget_->SetBounds(bounds); | |
41 if (layer_.get()) | |
42 layer_->SetBounds(bounds); | |
43 } | |
44 | |
45 | |
46 void DesktopBackgroundComponent::Reparent(aura::RootWindow* root_window , | |
sky
2012/07/25 20:47:36
remove white space
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Done.
| |
47 int src_container, | |
48 int dest_container) { | |
49 if (widget_) { | |
50 views::Widget::ReparentNativeView(widget_->GetNativeView(), | |
51 root_window->GetChildById(dest_container)); | |
52 } | |
53 if (layer_.get()) { | |
54 ui::Layer* layer = layer_.get(); | |
55 root_window->GetChildById(src_container)->layer()->Remove(layer); | |
56 root_window->GetChildById(dest_container)->layer()->Add(layer); | |
57 } | |
58 } | |
59 | |
60 } // namespace internal | |
61 } // namespace ash | |
OLD | NEW |