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

Side by Side Diff: ash/wm/root_window_layout_manager.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: 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/root_window_layout_manager.h" 5 #include "ash/wm/root_window_layout_manager.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/views/widget/widget.h" 9 #include "ui/views/widget/widget.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace internal { 12 namespace internal {
13 13
14 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
15 // RootWindowLayoutManager, public: 15 // RootWindowLayoutManager, public:
16 16
17 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner) 17 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
18 : owner_(owner), 18 : owner_(owner) {
19 background_widget_(NULL) { 19 for (int i = 0; i < kShellWindowCount; i++)
20 background_widget_[i] = NULL;
20 } 21 }
21 22
22 RootWindowLayoutManager::~RootWindowLayoutManager() { 23 RootWindowLayoutManager::~RootWindowLayoutManager() {
23 } 24 }
24 25
25 void RootWindowLayoutManager::SetBackgroundWidget(views::Widget* widget) { 26 void RootWindowLayoutManager::SetBackgroundWidget(views::Widget* widget,
26 if (widget == background_widget_) 27 int container_id) {
28 if (widget == background_widget_[container_id])
27 return; 29 return;
28 // Close now so that the focus manager will be deleted before shutdown. 30 // Close now so that the focus manager will be deleted before shutdown.
29 if (background_widget_) 31 if (background_widget_[container_id])
30 background_widget_->CloseNow(); 32 background_widget_[container_id]->CloseNow();
31 background_widget_ = widget; 33 background_widget_[container_id] = widget;
32 } 34 }
33 35
34 void RootWindowLayoutManager::SetBackgroundLayer(ui::Layer* layer) { 36 void RootWindowLayoutManager::SetBackgroundLayer(ui::Layer* layer,
35 background_layer_.reset(layer); 37 int container_id) {
38 background_layer_[container_id].reset(layer);
39 }
40
41 void RootWindowLayoutManager::DropBackgroundForContainer(int container_id) {
42 SetBackgroundLayer(NULL, container_id);
43 SetBackgroundWidget(NULL, container_id);
36 } 44 }
37 45
38 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
39 // RootWindowLayoutManager, aura::LayoutManager implementation: 47 // RootWindowLayoutManager, aura::LayoutManager implementation:
40 48
41 void RootWindowLayoutManager::OnWindowResized() { 49 void RootWindowLayoutManager::OnWindowResized() {
42 gfx::Rect fullscreen_bounds = 50 gfx::Rect fullscreen_bounds =
43 gfx::Rect(owner_->bounds().width(), owner_->bounds().height()); 51 gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
44 52
45 // Resize both our immediate children (the containers-of-containers animated 53 // Resize both our immediate children (the containers-of-containers animated
46 // by PowerButtonController) and their children (the actual containers). 54 // by PowerButtonController) and their children (the actual containers).
47 aura::Window::Windows::const_iterator i; 55 aura::Window::Windows::const_iterator i;
48 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { 56 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) {
49 (*i)->SetBounds(fullscreen_bounds); 57 (*i)->SetBounds(fullscreen_bounds);
50 aura::Window::Windows::const_iterator j; 58 aura::Window::Windows::const_iterator j;
51 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j) 59 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j)
52 (*j)->SetBounds(fullscreen_bounds); 60 (*j)->SetBounds(fullscreen_bounds);
53 } 61 }
54 62 for (int i = 0; i < kShellWindowCount; i++) {
55 if (background_widget_) 63 if (background_widget_[i])
56 background_widget_->SetBounds(fullscreen_bounds); 64 background_widget_[i]->SetBounds(fullscreen_bounds);
57 if (background_layer_.get()) 65 if (background_layer_[i].get())
58 background_layer_->SetBounds(fullscreen_bounds); 66 background_layer_[i]->SetBounds(fullscreen_bounds);
67 }
59 } 68 }
60 69
61 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 70 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
62 } 71 }
63 72
64 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout( 73 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
65 aura::Window* child) { 74 aura::Window* child) {
66 } 75 }
67 76
68 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { 77 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
69 } 78 }
70 79
71 void RootWindowLayoutManager::OnChildWindowVisibilityChanged( 80 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
72 aura::Window* child, 81 aura::Window* child,
73 bool visible) { 82 bool visible) {
74 } 83 }
75 84
76 void RootWindowLayoutManager::SetChildBounds( 85 void RootWindowLayoutManager::SetChildBounds(
77 aura::Window* child, 86 aura::Window* child,
78 const gfx::Rect& requested_bounds) { 87 const gfx::Rect& requested_bounds) {
79 SetChildBoundsDirect(child, requested_bounds); 88 SetChildBoundsDirect(child, requested_bounds);
80 } 89 }
81 90
82 } // namespace internal 91 } // namespace internal
83 } // namespace ash 92 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698