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

Side by Side Diff: ash/common/wm/root_window_layout_manager.cc

Issue 2790583004: Add second copy request after screen rotation to flatten the layers in animation. (Closed)
Patch Set: Move some functions to ash/utility/transformer_util. Created 3 years, 8 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/common/wm/root_window_layout_manager.h" 5 #include "ash/common/wm/root_window_layout_manager.h"
6 6
7 #include "ash/common/wm_window.h" 7 #include "ash/common/wm_window.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/aura/window_tracker.h" 9 #include "ui/aura/window_tracker.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace wm {
13 12
14 //////////////////////////////////////////////////////////////////////////////// 13 namespace {
15 // RootWindowLayoutManager, public:
16 14
17 RootWindowLayoutManager::RootWindowLayoutManager(WmWindow* owner) 15 void ResizeWindow(const aura::Window::Windows& children,
18 : owner_(owner) {} 16 const gfx::Rect& fullscreen_bounds,
19 17 int depth) {
20 RootWindowLayoutManager::~RootWindowLayoutManager() {} 18 // Stop to prevent resizing non top level window such as tooltip.
21 19 if (depth > 2)
22 //////////////////////////////////////////////////////////////////////////////// 20 return;
23 // RootWindowLayoutManager, aura::LayoutManager implementation:
24
25 void RootWindowLayoutManager::OnWindowResized() {
26 const gfx::Rect fullscreen_bounds = gfx::Rect(owner_->GetBounds().size());
27 21
28 // Resize both our immediate children (the containers-of-containers animated 22 // Resize both our immediate children (the containers-of-containers animated
29 // by PowerButtonController) and their children (the actual containers). 23 // by PowerButtonController) and their children (the actual containers).
30 aura::WindowTracker children_tracker(owner_->aura_window()->children()); 24 const int child_depth = depth + 1;
25 aura::WindowTracker children_tracker(children);
31 while (!children_tracker.windows().empty()) { 26 while (!children_tracker.windows().empty()) {
32 aura::Window* child = children_tracker.Pop(); 27 aura::Window* child = children_tracker.Pop();
33 // Skip descendants of top-level windows, i.e. only resize containers and 28 // Skip descendants of top-level windows, i.e. only resize containers and
34 // other windows without a delegate, such as ScreenDimmer windows. 29 // other windows without a delegate, such as ScreenDimmer windows.
35 if (child->GetToplevelWindow()) 30 if (child->GetToplevelWindow())
36 continue; 31 continue;
37 32
38 child->SetBounds(fullscreen_bounds); 33 child->SetBounds(fullscreen_bounds);
39 aura::WindowTracker grandchildren_tracker(child->children()); 34 ResizeWindow(child->children(), fullscreen_bounds, child_depth);
40 while (!grandchildren_tracker.windows().empty()) {
41 child = grandchildren_tracker.Pop();
42 if (!child->GetToplevelWindow())
43 child->SetBounds(fullscreen_bounds);
44 }
45 } 35 }
46 } 36 }
47 37
38 } // namespace
39
40 namespace wm {
41
42 ////////////////////////////////////////////////////////////////////////////////
43 // RootWindowLayoutManager, public:
44
45 RootWindowLayoutManager::RootWindowLayoutManager(WmWindow* owner)
46 : owner_(owner) {}
47
48 RootWindowLayoutManager::~RootWindowLayoutManager() {}
49
50 ////////////////////////////////////////////////////////////////////////////////
51 // RootWindowLayoutManager, aura::LayoutManager implementation:
52
53 void RootWindowLayoutManager::OnWindowResized() {
54 ResizeWindow(owner_->aura_window()->children(),
55 gfx::Rect(owner_->GetBounds().size()), 0);
56 }
57
48 void RootWindowLayoutManager::OnWindowAddedToLayout(WmWindow* child) {} 58 void RootWindowLayoutManager::OnWindowAddedToLayout(WmWindow* child) {}
49 59
50 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {} 60 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {}
51 61
52 void RootWindowLayoutManager::OnWindowRemovedFromLayout(WmWindow* child) {} 62 void RootWindowLayoutManager::OnWindowRemovedFromLayout(WmWindow* child) {}
53 63
54 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(WmWindow* child, 64 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(WmWindow* child,
55 bool visible) {} 65 bool visible) {}
56 66
57 void RootWindowLayoutManager::SetChildBounds( 67 void RootWindowLayoutManager::SetChildBounds(
58 WmWindow* child, 68 WmWindow* child,
59 const gfx::Rect& requested_bounds) { 69 const gfx::Rect& requested_bounds) {
60 child->SetBoundsDirect(requested_bounds); 70 child->SetBoundsDirect(requested_bounds);
61 } 71 }
62 72
63 } // namespace wm 73 } // namespace wm
64 } // namespace ash 74 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698