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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 // Shelf we're in. NULL if deleted before we're deleted. | 181 // Shelf we're in. NULL if deleted before we're deleted. |
182 ShelfLayoutManager* shelf_; | 182 ShelfLayoutManager* shelf_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); | 184 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); |
185 }; | 185 }; |
186 | 186 |
187 // ShelfLayoutManager ---------------------------------------------------------- | 187 // ShelfLayoutManager ---------------------------------------------------------- |
188 | 188 |
189 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) | 189 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) |
190 : root_window_(shelf->GetNativeView()->GetRootWindow()), | 190 : SnapToPixelLayoutManager(shelf->GetNativeView()->parent()), |
| 191 root_window_(shelf->GetNativeView()->GetRootWindow()), |
191 updating_bounds_(false), | 192 updating_bounds_(false), |
192 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), | 193 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), |
193 alignment_(SHELF_ALIGNMENT_BOTTOM), | 194 alignment_(SHELF_ALIGNMENT_BOTTOM), |
194 shelf_(shelf), | 195 shelf_(shelf), |
195 workspace_controller_(NULL), | 196 workspace_controller_(NULL), |
196 window_overlaps_shelf_(false), | 197 window_overlaps_shelf_(false), |
197 mouse_over_shelf_when_auto_hide_timer_started_(false), | 198 mouse_over_shelf_when_auto_hide_timer_started_(false), |
198 bezel_event_filter_(new ShelfBezelEventFilter(this)), | 199 bezel_event_filter_(new ShelfBezelEventFilter(this)), |
199 gesture_drag_status_(GESTURE_DRAG_NONE), | 200 gesture_drag_status_(GESTURE_DRAG_NONE), |
200 gesture_drag_amount_(0.f), | 201 gesture_drag_amount_(0.f), |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 duration_override_in_ms_ = duration_override_in_ms; | 509 duration_override_in_ms_ = duration_override_in_ms; |
509 } | 510 } |
510 | 511 |
511 //////////////////////////////////////////////////////////////////////////////// | 512 //////////////////////////////////////////////////////////////////////////////// |
512 // ShelfLayoutManager, aura::LayoutManager implementation: | 513 // ShelfLayoutManager, aura::LayoutManager implementation: |
513 | 514 |
514 void ShelfLayoutManager::OnWindowResized() { | 515 void ShelfLayoutManager::OnWindowResized() { |
515 LayoutShelf(); | 516 LayoutShelf(); |
516 } | 517 } |
517 | 518 |
518 void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | |
519 } | |
520 | |
521 void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { | |
522 } | |
523 | |
524 void ShelfLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | |
525 } | |
526 | |
527 void ShelfLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, | |
528 bool visible) { | |
529 } | |
530 | |
531 void ShelfLayoutManager::SetChildBounds(aura::Window* child, | 519 void ShelfLayoutManager::SetChildBounds(aura::Window* child, |
532 const gfx::Rect& requested_bounds) { | 520 const gfx::Rect& requested_bounds) { |
533 SetChildBoundsDirect(child, requested_bounds); | 521 SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds); |
534 // We may contain other widgets (such as frame maximize bubble) but they don't | 522 // We may contain other widgets (such as frame maximize bubble) but they don't |
535 // effect the layout in anyway. | 523 // effect the layout in anyway. |
536 if (!updating_bounds_ && | 524 if (!updating_bounds_ && |
537 ((shelf_->GetNativeView() == child) || | 525 ((shelf_->GetNativeView() == child) || |
538 (shelf_->status_area_widget()->GetNativeView() == child))) { | 526 (shelf_->status_area_widget()->GetNativeView() == child))) { |
539 LayoutShelf(); | 527 LayoutShelf(); |
540 } | 528 } |
541 } | 529 } |
542 | 530 |
543 void ShelfLayoutManager::OnLockStateChanged(bool locked) { | 531 void ShelfLayoutManager::OnLockStateChanged(bool locked) { |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 | 1144 |
1157 void ShelfLayoutManager::SessionStateChanged( | 1145 void ShelfLayoutManager::SessionStateChanged( |
1158 SessionStateDelegate::SessionState state) { | 1146 SessionStateDelegate::SessionState state) { |
1159 TargetBounds target_bounds; | 1147 TargetBounds target_bounds; |
1160 CalculateTargetBounds(state_, &target_bounds); | 1148 CalculateTargetBounds(state_, &target_bounds); |
1161 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1149 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
1162 UpdateVisibilityState(); | 1150 UpdateVisibilityState(); |
1163 } | 1151 } |
1164 | 1152 |
1165 } // namespace ash | 1153 } // namespace ash |
OLD | NEW |