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/toplevel_layout_manager.h" | 5 #include "ui/aura_shell/toplevel_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/shelf_layout_manager.h" | 9 #include "ui/aura_shell/shelf_layout_manager.h" |
10 #include "ui/aura_shell/window_util.h" | 10 #include "ui/aura_shell/window_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) | 21 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) |
22 (*i)->RemoveObserver(this); | 22 (*i)->RemoveObserver(this); |
23 } | 23 } |
24 | 24 |
25 void ToplevelLayoutManager::OnWindowResized() { | 25 void ToplevelLayoutManager::OnWindowResized() { |
26 } | 26 } |
27 | 27 |
28 void ToplevelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 28 void ToplevelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
29 windows_.insert(child); | 29 windows_.insert(child); |
30 child->AddObserver(this); | 30 child->AddObserver(this); |
31 if (child->GetProperty(aura::kShowStateKey)) { | 31 if (child->GetProperty(aura::client::kShowStateKey)) { |
32 UpdateBoundsFromShowState(child); | 32 UpdateBoundsFromShowState(child); |
33 UpdateShelfVisibility(); | 33 UpdateShelfVisibility(); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 void ToplevelLayoutManager::OnWillRemoveWindowFromLayout( | 37 void ToplevelLayoutManager::OnWillRemoveWindowFromLayout( |
38 aura::Window* child) { | 38 aura::Window* child) { |
39 windows_.erase(child); | 39 windows_.erase(child); |
40 child->RemoveObserver(this); | 40 child->RemoveObserver(this); |
41 UpdateShelfVisibility(); | 41 UpdateShelfVisibility(); |
(...skipping 12 matching lines...) Expand all Loading... |
54 if (child_bounds.y() < 0) | 54 if (child_bounds.y() < 0) |
55 child_bounds.set_y(0); | 55 child_bounds.set_y(0); |
56 else if (child_bounds.y() + kTitleHeight > work_area.bottom()) | 56 else if (child_bounds.y() + kTitleHeight > work_area.bottom()) |
57 child_bounds.set_y(work_area.bottom() - kTitleHeight); | 57 child_bounds.set_y(work_area.bottom() - kTitleHeight); |
58 SetChildBoundsDirect(child, child_bounds); | 58 SetChildBoundsDirect(child, child_bounds); |
59 } | 59 } |
60 | 60 |
61 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 61 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
62 const char* name, | 62 const char* name, |
63 void* old) { | 63 void* old) { |
64 if (name == aura::kShowStateKey) { | 64 if (name == aura::client::kShowStateKey) { |
65 UpdateBoundsFromShowState(window); | 65 UpdateBoundsFromShowState(window); |
66 UpdateShelfVisibility(); | 66 UpdateShelfVisibility(); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 void ToplevelLayoutManager::UpdateShelfVisibility() { | 70 void ToplevelLayoutManager::UpdateShelfVisibility() { |
71 if (!shelf_) | 71 if (!shelf_) |
72 return; | 72 return; |
73 | 73 |
74 bool has_fullscreen_window = false; | 74 bool has_fullscreen_window = false; |
75 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) { | 75 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) { |
76 if ((*i)->GetIntProperty(aura::kShowStateKey) == | 76 if ((*i)->GetIntProperty(aura::client::kShowStateKey) == |
77 ui::SHOW_STATE_FULLSCREEN) { | 77 ui::SHOW_STATE_FULLSCREEN) { |
78 has_fullscreen_window = true; | 78 has_fullscreen_window = true; |
79 break; | 79 break; |
80 } | 80 } |
81 } | 81 } |
82 shelf_->SetVisible(!has_fullscreen_window); | 82 shelf_->SetVisible(!has_fullscreen_window); |
83 } | 83 } |
84 | 84 |
85 } // namespace internal | 85 } // namespace internal |
86 } // namespace aura_shell | 86 } // namespace aura_shell |
OLD | NEW |