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

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

Issue 9616045: Aura/Ash split: Move ScreenAura to ash::ScreenAsh. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a separate aura::TestScreen in tests instead, partially reverting to patchset 2 Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/base_layout_manager.h ('k') | ash/wm/base_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/base_layout_manager.h" 5 #include "ash/wm/base_layout_manager.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/property_util.h" 8 #include "ash/wm/property_util.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/root_window.h" 11 #include "ui/aura/root_window.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/base/ui_base_types.h" 13 #include "ui/base/ui_base_types.h"
14 #include "ui/gfx/screen.h" 14 #include "ui/gfx/screen.h"
15 15
16 namespace ash { 16 namespace ash {
17 namespace internal { 17 namespace internal {
18 18
19 ///////////////////////////////////////////////////////////////////////////// 19 /////////////////////////////////////////////////////////////////////////////
20 // BaseLayoutManager, public: 20 // BaseLayoutManager, public:
21 21
22 BaseLayoutManager::BaseLayoutManager() { 22 BaseLayoutManager::BaseLayoutManager() {
23 Shell::GetInstance()->AddShellObserver(this);
23 Shell::GetRootWindow()->AddRootWindowObserver(this); 24 Shell::GetRootWindow()->AddRootWindowObserver(this);
24 } 25 }
25 26
26 BaseLayoutManager::~BaseLayoutManager() { 27 BaseLayoutManager::~BaseLayoutManager() {
27 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) 28 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
28 (*i)->RemoveObserver(this); 29 (*i)->RemoveObserver(this);
29 Shell::GetRootWindow()->RemoveRootWindowObserver(this); 30 Shell::GetRootWindow()->RemoveRootWindowObserver(this);
31 Shell::GetInstance()->RemoveShellObserver(this);
30 } 32 }
31 33
32 ///////////////////////////////////////////////////////////////////////////// 34 /////////////////////////////////////////////////////////////////////////////
33 // BaseLayoutManager, LayoutManager overrides: 35 // BaseLayoutManager, LayoutManager overrides:
34 36
35 void BaseLayoutManager::OnWindowResized() { 37 void BaseLayoutManager::OnWindowResized() {
36 } 38 }
37 39
38 void BaseLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 40 void BaseLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
39 windows_.insert(child); 41 windows_.insert(child);
(...skipping 23 matching lines...) Expand all
63 SetChildBoundsDirect(child, child_bounds); 65 SetChildBoundsDirect(child, child_bounds);
64 } 66 }
65 67
66 ///////////////////////////////////////////////////////////////////////////// 68 /////////////////////////////////////////////////////////////////////////////
67 // BaseLayoutManager, RootWindowObserver overrides: 69 // BaseLayoutManager, RootWindowObserver overrides:
68 70
69 void BaseLayoutManager::OnRootWindowResized(const gfx::Size& new_size) { 71 void BaseLayoutManager::OnRootWindowResized(const gfx::Size& new_size) {
70 AdjustWindowSizesForScreenChange(); 72 AdjustWindowSizesForScreenChange();
71 } 73 }
72 74
75 /////////////////////////////////////////////////////////////////////////////
76 // BaseLayoutManager, ash::ShellObserver overrides:
77
73 void BaseLayoutManager::OnScreenWorkAreaInsetsChanged() { 78 void BaseLayoutManager::OnScreenWorkAreaInsetsChanged() {
74 AdjustWindowSizesForScreenChange(); 79 AdjustWindowSizesForScreenChange();
75 } 80 }
76 81
77 ///////////////////////////////////////////////////////////////////////////// 82 /////////////////////////////////////////////////////////////////////////////
78 // BaseLayoutManager, WindowObserver overrides: 83 // BaseLayoutManager, WindowObserver overrides:
79 84
80 void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window, 85 void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window,
81 const void* key, 86 const void* key,
82 intptr_t old) { 87 intptr_t old) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 gfx::Rect monitor_rect = wm::IsWindowFullscreen(window) ? 131 gfx::Rect monitor_rect = wm::IsWindowFullscreen(window) ?
127 gfx::Screen::GetMonitorAreaNearestWindow(window) : 132 gfx::Screen::GetMonitorAreaNearestWindow(window) :
128 gfx::Screen::GetMonitorWorkAreaNearestWindow(window); 133 gfx::Screen::GetMonitorWorkAreaNearestWindow(window);
129 // Put as much of the window as possible within the monitor area. 134 // Put as much of the window as possible within the monitor area.
130 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); 135 window->SetBounds(window->bounds().AdjustToFit(monitor_rect));
131 } 136 }
132 } 137 }
133 138
134 } // namespace internal 139 } // namespace internal
135 } // namespace ash 140 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/base_layout_manager.h ('k') | ash/wm/base_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698