| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 void ShelfLayoutManager::OnLockStateChanged(bool locked) { | 539 void ShelfLayoutManager::OnLockStateChanged(bool locked) { |
| 540 // Force the shelf to layout for alignment (bottom if locked, restore | 540 // Force the shelf to layout for alignment (bottom if locked, restore |
| 541 // the previous alignment otherwise). | 541 // the previous alignment otherwise). |
| 542 shelf_->SetAlignment(locked ? SHELF_ALIGNMENT_BOTTOM : alignment_); | 542 shelf_->SetAlignment(locked ? SHELF_ALIGNMENT_BOTTOM : alignment_); |
| 543 UpdateVisibilityState(); | 543 UpdateVisibilityState(); |
| 544 LayoutShelf(); | 544 LayoutShelf(); |
| 545 } | 545 } |
| 546 | 546 |
| 547 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active, | 547 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active, |
| 548 aura::Window* lost_active) { | 548 aura::Window* lost_active) { |
| 549 UpdateVisibilityState(); |
| 549 UpdateAutoHideStateNow(); | 550 UpdateAutoHideStateNow(); |
| 550 } | 551 } |
| 551 | 552 |
| 552 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 553 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
| 553 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || | 554 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || |
| 554 GetAlignment() == SHELF_ALIGNMENT_TOP; | 555 GetAlignment() == SHELF_ALIGNMENT_TOP; |
| 555 } | 556 } |
| 556 | 557 |
| 557 // static | 558 // static |
| 558 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { | 559 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 return gfx::Insets(0, distance, 0, 0); | 1151 return gfx::Insets(0, distance, 0, 0); |
| 1151 case SHELF_ALIGNMENT_TOP: | 1152 case SHELF_ALIGNMENT_TOP: |
| 1152 return gfx::Insets(0, 0, distance, 0); | 1153 return gfx::Insets(0, 0, distance, 0); |
| 1153 } | 1154 } |
| 1154 NOTREACHED(); | 1155 NOTREACHED(); |
| 1155 return gfx::Insets(); | 1156 return gfx::Insets(); |
| 1156 } | 1157 } |
| 1157 | 1158 |
| 1158 } // namespace internal | 1159 } // namespace internal |
| 1159 } // namespace ash | 1160 } // namespace ash |
| OLD | NEW |