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

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: Post-review fix #2 Created 8 years, 5 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)
20 : widget_(widget) {
Nikita (slow) 2012/07/28 01:32:17 nit: lines 19-20 could be combined.
Denis Kuznetsov (DE-MUC) 2012/07/30 15:40:02 Done.
21 }
22
23 DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
24 ui::Layer* layer)
Nikita (slow) 2012/07/28 01:32:17 nit: lines 24-25 could be combined.
Denis Kuznetsov (DE-MUC) 2012/07/30 15:40:02 Done.
25 : widget_(NULL) {
26 layer_.reset(layer);
27 }
28
29
30 DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
31 if (widget_) {
32 widget_->CloseNow();
33 widget_ = NULL;
34 }
35 if (layer_.get())
Nikita (slow) 2012/07/28 01:32:17 else if
Denis Kuznetsov (DE-MUC) 2012/07/30 15:40:02 Done.
36 layer_.reset(NULL);
37 }
38
39 void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
40 if (widget_)
41 widget_->SetBounds(bounds);
42 if (layer_.get())
Nikita (slow) 2012/07/28 01:32:17 else if
Denis Kuznetsov (DE-MUC) 2012/07/30 15:40:02 Done.
43 layer_->SetBounds(bounds);
44 }
45
46
47 void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
48 int src_container,
49 int dest_container) {
50 if (widget_) {
51 views::Widget::ReparentNativeView(widget_->GetNativeView(),
52 root_window->GetChildById(dest_container));
53 }
54 if (layer_.get()) {
Nikita (slow) 2012/07/28 01:32:17 else if
Denis Kuznetsov (DE-MUC) 2012/07/30 15:40:02 Done.
55 ui::Layer* layer = layer_.get();
56 root_window->GetChildById(src_container)->layer()->Remove(layer);
57 root_window->GetChildById(dest_container)->layer()->Add(layer);
58 }
59 }
60
61 } // namespace internal
62 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698