OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 gfx::ImageSkia launcher_background_left_; | 173 gfx::ImageSkia launcher_background_left_; |
174 gfx::ImageSkia launcher_background_right_; | 174 gfx::ImageSkia launcher_background_right_; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); | 176 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); |
177 }; | 177 }; |
178 | 178 |
179 namespace { | 179 namespace { |
180 | 180 |
181 // Returns true if a window is a popup or a transient child. | 181 // Returns true if a window is a popup or a transient child. |
182 bool IsPopupOrTransient(const aura::Window* window) { | 182 bool IsPopupOrTransient(const aura::Window* window) { |
183 return (window->type() == aura::client::WINDOW_TYPE_POPUP || | 183 return (window->type() == ui::wm::WINDOW_TYPE_POPUP || |
184 window->transient_parent()); | 184 window->transient_parent()); |
185 } | 185 } |
186 | 186 |
187 // Certain windows (minimized, hidden or popups) do not matter to docking. | 187 // Certain windows (minimized, hidden or popups) do not matter to docking. |
188 bool IsUsedByLayout(const aura::Window* window) { | 188 bool IsUsedByLayout(const aura::Window* window) { |
189 return (window->IsVisible() && | 189 return (window->IsVisible() && |
190 !wm::GetWindowState(window)->IsMinimized() && | 190 !wm::GetWindowState(window)->IsMinimized() && |
191 !IsPopupOrTransient(window)); | 191 !IsPopupOrTransient(window)); |
192 } | 192 } |
193 | 193 |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 int docked_panels_count = 0; | 889 int docked_panels_count = 0; |
890 int large_windows_count = 0; | 890 int large_windows_count = 0; |
891 for (size_t i = 0; i < dock_container_->children().size(); ++i) { | 891 for (size_t i = 0; i < dock_container_->children().size(); ++i) { |
892 const aura::Window* window(dock_container_->children()[i]); | 892 const aura::Window* window(dock_container_->children()[i]); |
893 if (IsPopupOrTransient(window)) | 893 if (IsPopupOrTransient(window)) |
894 continue; | 894 continue; |
895 docked_all_count++; | 895 docked_all_count++; |
896 if (!IsUsedByLayout(window)) | 896 if (!IsUsedByLayout(window)) |
897 continue; | 897 continue; |
898 docked_visible_count++; | 898 docked_visible_count++; |
899 if (window->type() == aura::client::WINDOW_TYPE_PANEL) | 899 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) |
900 docked_panels_count++; | 900 docked_panels_count++; |
901 const wm::WindowState* window_state = wm::GetWindowState(window); | 901 const wm::WindowState* window_state = wm::GetWindowState(window); |
902 if (window_state->HasRestoreBounds()) { | 902 if (window_state->HasRestoreBounds()) { |
903 const gfx::Rect restore_bounds = window_state->GetRestoreBoundsInScreen(); | 903 const gfx::Rect restore_bounds = window_state->GetRestoreBoundsInScreen(); |
904 if (restore_bounds.width() > kMaxDockWidth) | 904 if (restore_bounds.width() > kMaxDockWidth) |
905 large_windows_count++; | 905 large_windows_count++; |
906 } | 906 } |
907 } | 907 } |
908 UMA_HISTOGRAM_COUNTS_100("Ash.Dock.ItemsAll", docked_all_count); | 908 UMA_HISTOGRAM_COUNTS_100("Ash.Dock.ItemsAll", docked_all_count); |
909 UMA_HISTOGRAM_COUNTS_100("Ash.Dock.ItemsLarge", large_windows_count); | 909 UMA_HISTOGRAM_COUNTS_100("Ash.Dock.ItemsLarge", large_windows_count); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1231 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1232 const gfx::Rect& keyboard_bounds) { | 1232 const gfx::Rect& keyboard_bounds) { |
1233 // This bounds change will have caused a change to the Shelf which does not | 1233 // This bounds change will have caused a change to the Shelf which does not |
1234 // propagate automatically to this class, so manually recalculate bounds. | 1234 // propagate automatically to this class, so manually recalculate bounds. |
1235 Relayout(); | 1235 Relayout(); |
1236 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1236 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1237 } | 1237 } |
1238 | 1238 |
1239 } // namespace internal | 1239 } // namespace internal |
1240 } // namespace ash | 1240 } // namespace ash |
OLD | NEW |