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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/desktop_background/desktop_background_widget_controller.cc
diff --git a/ash/desktop_background/desktop_background_widget_controller.cc b/ash/desktop_background/desktop_background_widget_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6e6d799cb154400d6be68f0911d2d81a9936088b
--- /dev/null
+++ b/ash/desktop_background/desktop_background_widget_controller.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/desktop_background/desktop_background_widget_controller.h"
+
+#include "ui/aura/root_window.h"
+#include "ui/views/widget/widget.h"
+
+DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*);
+
+namespace ash {
+namespace internal {
+
+DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController,
+ kWindowDesktopComponent, NULL);
+
+DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
+ views::Widget* widget) : widget_(widget) {
+}
+
+DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
+ ui::Layer* layer) : widget_(NULL) {
+ layer_.reset(layer);
+}
+
+DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
+ if (widget_) {
+ widget_->CloseNow();
+ widget_ = NULL;
+ } else if (layer_.get())
+ layer_.reset(NULL);
+}
+
+void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
+ if (widget_)
+ widget_->SetBounds(bounds);
+ else if (layer_.get())
+ layer_->SetBounds(bounds);
+}
+
+
+void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
+ int src_container,
+ int dest_container) {
+ if (widget_) {
+ views::Widget::ReparentNativeView(widget_->GetNativeView(),
+ root_window->GetChildById(dest_container));
+ } else if (layer_.get()) {
+ ui::Layer* layer = layer_.get();
+ root_window->GetChildById(src_container)->layer()->Remove(layer);
+ root_window->GetChildById(dest_container)->layer()->Add(layer);
+ }
+}
+
+} // namespace internal
+} // namespace ash
« 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