OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/laptop_mode_layout_manager.h" | 5 #include "ui/aura_shell/laptop_mode_layout_manager.h" |
6 | 6 |
7 #include "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura_shell/window_util.h" | 9 #include "ui/aura_shell/window_util.h" |
10 #include "ui/base/ui_base_types.h" | 10 #include "ui/base/ui_base_types.h" |
11 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
12 | 12 |
13 namespace aura_shell { | 13 namespace aura_shell { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 LaptopModeLayoutManager::LaptopModeLayoutManager() { | 16 LaptopModeLayoutManager::LaptopModeLayoutManager() { |
17 } | 17 } |
18 | 18 |
19 LaptopModeLayoutManager::~LaptopModeLayoutManager() { | 19 LaptopModeLayoutManager::~LaptopModeLayoutManager() { |
20 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) | 20 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) |
21 (*i)->RemoveObserver(this); | 21 (*i)->RemoveObserver(this); |
22 } | 22 } |
23 | 23 |
24 void LaptopModeLayoutManager::OnWindowResized() { | 24 void LaptopModeLayoutManager::OnWindowResized() { |
25 } | 25 } |
26 | 26 |
27 void LaptopModeLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 27 void LaptopModeLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
28 windows_.insert(child); | 28 windows_.insert(child); |
29 child->AddObserver(this); | 29 child->AddObserver(this); |
30 if (child->GetProperty(aura::kShowStateKey)) | 30 if (child->GetProperty(aura::client::kShowStateKey)) |
31 UpdateBoundsFromShowState(child); | 31 UpdateBoundsFromShowState(child); |
32 } | 32 } |
33 | 33 |
34 void LaptopModeLayoutManager::OnWillRemoveWindowFromLayout( | 34 void LaptopModeLayoutManager::OnWillRemoveWindowFromLayout( |
35 aura::Window* child) { | 35 aura::Window* child) { |
36 windows_.erase(child); | 36 windows_.erase(child); |
37 child->RemoveObserver(this); | 37 child->RemoveObserver(this); |
38 } | 38 } |
39 | 39 |
40 void LaptopModeLayoutManager::OnChildWindowVisibilityChanged( | 40 void LaptopModeLayoutManager::OnChildWindowVisibilityChanged( |
41 aura::Window* child, | 41 aura::Window* child, |
42 bool visibile) { | 42 bool visibile) { |
43 } | 43 } |
44 | 44 |
45 void LaptopModeLayoutManager::SetChildBounds( | 45 void LaptopModeLayoutManager::SetChildBounds( |
46 aura::Window* child, | 46 aura::Window* child, |
47 const gfx::Rect& requested_bounds) { | 47 const gfx::Rect& requested_bounds) { |
48 gfx::Rect bounds = requested_bounds; | 48 gfx::Rect bounds = requested_bounds; |
49 // Avoid a janky resize on startup by ensuring the initial bounds fill the | 49 // Avoid a janky resize on startup by ensuring the initial bounds fill the |
50 // screen. | 50 // screen. |
51 if (child->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_MAXIMIZED) | 51 if (IsWindowMaximized(child)) |
52 bounds = gfx::Screen::GetPrimaryMonitorBounds(); | 52 bounds = gfx::Screen::GetPrimaryMonitorBounds(); |
53 SetChildBoundsDirect(child, bounds); | 53 SetChildBoundsDirect(child, bounds); |
54 } | 54 } |
55 | 55 |
56 void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 56 void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
57 const char* name, | 57 const char* name, |
58 void* old) { | 58 void* old) { |
59 if (name == aura::kShowStateKey) | 59 if (name == aura::client::kShowStateKey) |
60 UpdateBoundsFromShowState(window); | 60 UpdateBoundsFromShowState(window); |
61 } | 61 } |
62 | 62 |
63 } // namespace internal | 63 } // namespace internal |
64 } // namespace aura_shell | 64 } // namespace aura_shell |
OLD | NEW |