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

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: Add OVERRIDE 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
27 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
28 if (widget_) {
29 widget_->CloseNow();
30 widget_ = NULL;
31 } else if (layer_.get())
32 layer_.reset(NULL);
33 }
34
35 void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
36 if (widget_)
37 widget_->SetBounds(bounds);
38 else if (layer_.get())
39 layer_->SetBounds(bounds);
40 }
41
42
43 void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
44 int src_container,
45 int dest_container) {
46 if (widget_) {
47 views::Widget::ReparentNativeView(widget_->GetNativeView(),
48 root_window->GetChildById(dest_container));
49 } else if (layer_.get()) {
50 ui::Layer* layer = layer_.get();
51 root_window->GetChildById(src_container)->layer()->Remove(layer);
52 root_window->GetChildById(dest_container)->layer()->Add(layer);
53 }
54 }
55
56 } // namespace internal
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