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

Unified Diff: ash/desktop_background/desktop_background_component.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: Merge with ToT 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 side-by-side diff with in-line comments
Download patch
Index: ash/desktop_background/desktop_background_component.cc
diff --git a/ash/desktop_background/desktop_background_component.cc b/ash/desktop_background/desktop_background_component.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e5554f7801659bb90ba1d68041fdf8960700194e
--- /dev/null
+++ b/ash/desktop_background/desktop_background_component.cc
@@ -0,0 +1,61 @@
+// 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_component.h"
+
+#include "ui/aura/root_window.h"
+#include "ui/views/widget/widget.h"
+
+DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundComponent*);
+
+namespace ash {
+namespace internal {
+
+DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundComponent,
+ kWindowDesktopComponent, NULL);
+
+DesktopBackgroundComponent::DesktopBackgroundComponent(views::Widget* widget)
+ : widget_(widget) {
+}
+
+DesktopBackgroundComponent::DesktopBackgroundComponent(ui::Layer* layer)
+ : widget_(NULL) {
+ layer_.reset(layer);
+}
+
+
+DesktopBackgroundComponent::~DesktopBackgroundComponent() {
+ if (widget_) {
+ widget_->CloseNow();
+ widget_ = NULL;
+ }
+ 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.
+ layer_.reset(NULL);
+ }
+}
+
+void DesktopBackgroundComponent::SetBounds(gfx::Rect bounds) {
+ if (widget_)
+ widget_->SetBounds(bounds);
+ if (layer_.get())
+ layer_->SetBounds(bounds);
+}
+
+
+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.
+ int src_container,
+ int dest_container) {
+ if (widget_) {
+ views::Widget::ReparentNativeView(widget_->GetNativeView(),
+ root_window->GetChildById(dest_container));
+ }
+ 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

Powered by Google App Engine
This is Rietveld 408576698