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

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

Issue 1484383003: Use WindowTracker when resizing root window as it may delete other window in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « ash/ash.gyp ('k') | ash/wm/root_window_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/desktop_background/desktop_background_widget_controller.h" 7 #include "ash/desktop_background/desktop_background_widget_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/aura/window_tracker.h"
10 #include "ui/compositor/layer.h" 11 #include "ui/compositor/layer.h"
11 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
12 13
13 namespace ash { 14 namespace ash {
14 15
15 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
16 // RootWindowLayoutManager, public: 17 // RootWindowLayoutManager, public:
17 18
18 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner) 19 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
19 : owner_(owner) { 20 : owner_(owner) {
20 } 21 }
21 22
22 RootWindowLayoutManager::~RootWindowLayoutManager() { 23 RootWindowLayoutManager::~RootWindowLayoutManager() {
23 } 24 }
24 25
25 26
26 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
27 // RootWindowLayoutManager, aura::LayoutManager implementation: 28 // RootWindowLayoutManager, aura::LayoutManager implementation:
28 29
29 void RootWindowLayoutManager::OnWindowResized() { 30 void RootWindowLayoutManager::OnWindowResized() {
30 gfx::Rect fullscreen_bounds = 31 gfx::Rect fullscreen_bounds =
31 gfx::Rect(owner_->bounds().width(), owner_->bounds().height()); 32 gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
32 33
33 // Resize both our immediate children (the containers-of-containers animated 34 // Resize both our immediate children (the containers-of-containers animated
34 // by PowerButtonController) and their children (the actual containers). 35 // by PowerButtonController) and their children (the actual containers).
35 aura::Window::Windows::const_iterator i; 36 aura::WindowTracker children_tracker(owner_->children());
36 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { 37 while (children_tracker.has_windows()) {
37 (*i)->SetBounds(fullscreen_bounds); 38 aura::Window* child = children_tracker.Pop();
38 aura::Window::Windows::const_iterator j; 39 child->SetBounds(fullscreen_bounds);
39 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j) 40 aura::WindowTracker grandchildren_tracker(child->children());
40 (*j)->SetBounds(fullscreen_bounds); 41 while (grandchildren_tracker.has_windows())
sky 2015/12/02 22:01:04 WindowTracker internally uses a set. The old code
oshima 2015/12/03 05:50:12 Good point. I changed WT to use vector instead.
42 grandchildren_tracker.Pop()->SetBounds(fullscreen_bounds);
41 } 43 }
42 RootWindowController* root_window_controller = 44 RootWindowController* root_window_controller =
43 GetRootWindowController(owner_); 45 GetRootWindowController(owner_);
44 DesktopBackgroundWidgetController* background = 46 DesktopBackgroundWidgetController* background =
45 root_window_controller->wallpaper_controller(); 47 root_window_controller->wallpaper_controller();
46 48
47 if (!background && root_window_controller->animating_wallpaper_controller()) { 49 if (!background && root_window_controller->animating_wallpaper_controller()) {
48 background = root_window_controller->animating_wallpaper_controller()-> 50 background = root_window_controller->animating_wallpaper_controller()->
49 GetController(false); 51 GetController(false);
50 } 52 }
(...skipping 16 matching lines...) Expand all
67 bool visible) { 69 bool visible) {
68 } 70 }
69 71
70 void RootWindowLayoutManager::SetChildBounds( 72 void RootWindowLayoutManager::SetChildBounds(
71 aura::Window* child, 73 aura::Window* child,
72 const gfx::Rect& requested_bounds) { 74 const gfx::Rect& requested_bounds) {
73 SetChildBoundsDirect(child, requested_bounds); 75 SetChildBoundsDirect(child, requested_bounds);
74 } 76 }
75 77
76 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/wm/root_window_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698