OLD | NEW |
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/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/aura/window_tracker.h" | 30 #include "ui/aura/window_tracker.h" |
31 #include "ui/compositor/scoped_layer_animation_settings.h" | 31 #include "ui/compositor/scoped_layer_animation_settings.h" |
32 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
33 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
34 #include "ui/gfx/vector2d.h" | 34 #include "ui/gfx/vector2d.h" |
35 #include "ui/views/background.h" | 35 #include "ui/views/background.h" |
36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
37 #include "ui/wm/public/activation_client.h" | 37 #include "ui/wm/public/activation_client.h" |
38 | 38 |
39 namespace ash { | 39 namespace ash { |
40 namespace internal { | 40 namespace { |
41 | 41 |
42 namespace { | |
43 const int kPanelIdealSpacing = 4; | 42 const int kPanelIdealSpacing = 4; |
44 | 43 |
45 const float kMaxHeightFactor = .80f; | 44 const float kMaxHeightFactor = .80f; |
46 const float kMaxWidthFactor = .50f; | 45 const float kMaxWidthFactor = .50f; |
47 | 46 |
48 // Duration for panel animations. | 47 // Duration for panel animations. |
49 const int kPanelSlideDurationMilliseconds = 50; | 48 const int kPanelSlideDurationMilliseconds = 50; |
50 const int kCalloutFadeDurationMilliseconds = 50; | 49 const int kCalloutFadeDurationMilliseconds = 50; |
51 | 50 |
52 // Offset used when sliding panel in/out of the shelf. Used for minimizing, | 51 // Offset used when sliding panel in/out of the shelf. Used for minimizing, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 dragged_panel_ = NULL; | 302 dragged_panel_ = NULL; |
304 Relayout(); | 303 Relayout(); |
305 } | 304 } |
306 | 305 |
307 void PanelLayoutManager::SetShelf(Shelf* shelf) { | 306 void PanelLayoutManager::SetShelf(Shelf* shelf) { |
308 DCHECK(!shelf_); | 307 DCHECK(!shelf_); |
309 DCHECK(!shelf_layout_manager_); | 308 DCHECK(!shelf_layout_manager_); |
310 shelf_ = shelf; | 309 shelf_ = shelf; |
311 shelf_->AddIconObserver(this); | 310 shelf_->AddIconObserver(this); |
312 if (shelf_->shelf_widget()) { | 311 if (shelf_->shelf_widget()) { |
313 shelf_layout_manager_ = ash::internal::ShelfLayoutManager::ForShelf( | 312 shelf_layout_manager_ = ash::ShelfLayoutManager::ForShelf( |
314 shelf_->shelf_widget()->GetNativeWindow()); | 313 shelf_->shelf_widget()->GetNativeWindow()); |
315 WillChangeVisibilityState(shelf_layout_manager_->visibility_state()); | 314 WillChangeVisibilityState(shelf_layout_manager_->visibility_state()); |
316 shelf_layout_manager_->AddObserver(this); | 315 shelf_layout_manager_->AddObserver(this); |
317 } | 316 } |
318 } | 317 } |
319 | 318 |
320 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) { | 319 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) { |
321 DCHECK(panel->parent() == panel_container_); | 320 DCHECK(panel->parent() == panel_container_); |
322 wm::WindowState* window_state = wm::GetWindowState(panel); | 321 wm::WindowState* window_state = wm::GetWindowState(panel); |
323 if (window_state->IsMinimized()) | 322 if (window_state->IsMinimized()) |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 //////////////////////////////////////////////////////////////////////////////// | 877 //////////////////////////////////////////////////////////////////////////////// |
879 // keyboard::KeyboardControllerObserver implementation: | 878 // keyboard::KeyboardControllerObserver implementation: |
880 | 879 |
881 void PanelLayoutManager::OnKeyboardBoundsChanging( | 880 void PanelLayoutManager::OnKeyboardBoundsChanging( |
882 const gfx::Rect& keyboard_bounds) { | 881 const gfx::Rect& keyboard_bounds) { |
883 // This bounds change will have caused a change to the Shelf which does not | 882 // This bounds change will have caused a change to the Shelf which does not |
884 // propogate automatically to this class, so manually recalculate bounds. | 883 // propogate automatically to this class, so manually recalculate bounds. |
885 OnWindowResized(); | 884 OnWindowResized(); |
886 } | 885 } |
887 | 886 |
888 } // namespace internal | |
889 } // namespace ash | 887 } // namespace ash |
OLD | NEW |