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

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

Issue 10810039: 2nd display should show the same background as login/lock screen: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix of Nikita's comments 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
OLDNEW
(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_widget_controller.h"
6
7 #include "ui/aura/root_window.h"
8 #include "ui/views/widget/widget.h"
9
10 DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*);
11
12 namespace ash {
13 namespace internal {
14
15 DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController,
16 kWindowDesktopComponent, NULL);
17
18 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
19 views::Widget* widget) : widget_(widget) {
20 }
21
22 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
23 ui::Layer* layer) : widget_(NULL) {
24 layer_.reset(layer);
25 }
26
bshe 2012/07/30 21:38:20 nit: remove the extra line here.
27
28 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
29 if (widget_) {
30 widget_->CloseNow();
31 widget_ = NULL;
32 } else if (layer_.get())
33 layer_.reset(NULL);
34 }
35
36 void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
37 if (widget_)
38 widget_->SetBounds(bounds);
39 else if (layer_.get())
40 layer_->SetBounds(bounds);
41 }
42
43
44 void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
45 int src_container,
46 int dest_container) {
47 if (widget_) {
48 views::Widget::ReparentNativeView(widget_->GetNativeView(),
49 root_window->GetChildById(dest_container));
50 } else if (layer_.get()) {
51 ui::Layer* layer = layer_.get();
52 root_window->GetChildById(src_container)->layer()->Remove(layer);
53 root_window->GetChildById(dest_container)->layer()->Add(layer);
54 }
55 }
56
57 } // namespace internal
58 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698