| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && | 579 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && |
| 580 keyboard_is_about_to_hide) { | 580 keyboard_is_about_to_hide) { |
| 581 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); | 581 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 | 584 |
| 585 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 585 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
| 586 return ::ash::IsHorizontalAlignment(GetAlignment()); | 586 return ::ash::IsHorizontalAlignment(GetAlignment()); |
| 587 } | 587 } |
| 588 | 588 |
| 589 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
| 590 if (state_.visibility_state != SHELF_AUTO_HIDE && |
| 591 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
| 592 return SHELF_BACKGROUND_MAXIMIZED; |
| 593 } |
| 594 |
| 595 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
| 596 (!state_.is_screen_locked && !state_.is_adding_user_screen && |
| 597 window_overlaps_shelf_) || |
| 598 (state_.visibility_state == SHELF_AUTO_HIDE)) { |
| 599 return SHELF_BACKGROUND_OVERLAP; |
| 600 } |
| 601 |
| 602 return SHELF_BACKGROUND_DEFAULT; |
| 603 } |
| 604 |
| 589 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { | 605 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
| 590 chromevox_panel_height_ = height; | 606 chromevox_panel_height_ = height; |
| 591 LayoutShelf(); | 607 LayoutShelf(); |
| 592 } | 608 } |
| 593 | 609 |
| 594 //////////////////////////////////////////////////////////////////////////////// | 610 //////////////////////////////////////////////////////////////////////////////// |
| 595 // ShelfLayoutManager, private: | 611 // ShelfLayoutManager, private: |
| 596 | 612 |
| 597 ShelfLayoutManager::TargetBounds::TargetBounds() | 613 ShelfLayoutManager::TargetBounds::TargetBounds() |
| 598 : opacity(0.0f), status_opacity(0.0f) {} | 614 : opacity(0.0f), status_opacity(0.0f) {} |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 target_bounds->status_bounds_in_shelf.set_x( | 982 target_bounds->status_bounds_in_shelf.set_x( |
| 967 target_bounds->shelf_bounds_in_root.width() - | 983 target_bounds->shelf_bounds_in_root.width() - |
| 968 GetShelfConstant(SHELF_SIZE)); | 984 GetShelfConstant(SHELF_SIZE)); |
| 969 } | 985 } |
| 970 } | 986 } |
| 971 } | 987 } |
| 972 | 988 |
| 973 void ShelfLayoutManager::UpdateShelfBackground( | 989 void ShelfLayoutManager::UpdateShelfBackground( |
| 974 BackgroundAnimatorChangeType type) { | 990 BackgroundAnimatorChangeType type) { |
| 975 const ShelfBackgroundType background_type(GetShelfBackgroundType()); | 991 const ShelfBackgroundType background_type(GetShelfBackgroundType()); |
| 976 shelf_widget_->SetPaintsBackground(background_type, type); | |
| 977 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 992 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 978 OnBackgroundUpdated(background_type, type)); | 993 OnBackgroundUpdated(background_type, type)); |
| 979 } | 994 } |
| 980 | 995 |
| 981 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | |
| 982 if (state_.visibility_state != SHELF_AUTO_HIDE && | |
| 983 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | |
| 984 return SHELF_BACKGROUND_MAXIMIZED; | |
| 985 } | |
| 986 | |
| 987 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | |
| 988 (!state_.is_screen_locked && !state_.is_adding_user_screen && | |
| 989 window_overlaps_shelf_) || | |
| 990 (state_.visibility_state == SHELF_AUTO_HIDE)) { | |
| 991 return SHELF_BACKGROUND_OVERLAP; | |
| 992 } | |
| 993 | |
| 994 return SHELF_BACKGROUND_DEFAULT; | |
| 995 } | |
| 996 | |
| 997 void ShelfLayoutManager::UpdateAutoHideStateNow() { | 996 void ShelfLayoutManager::UpdateAutoHideStateNow() { |
| 998 SetState(state_.visibility_state); | 997 SetState(state_.visibility_state); |
| 999 | 998 |
| 1000 // If the state did not change, the auto hide timer may still be running. | 999 // If the state did not change, the auto hide timer may still be running. |
| 1001 StopAutoHideTimer(); | 1000 StopAutoHideTimer(); |
| 1002 } | 1001 } |
| 1003 | 1002 |
| 1004 void ShelfLayoutManager::StopAutoHideTimer() { | 1003 void ShelfLayoutManager::StopAutoHideTimer() { |
| 1005 auto_hide_timer_.Stop(); | 1004 auto_hide_timer_.Stop(); |
| 1006 mouse_over_shelf_when_auto_hide_timer_started_ = false; | 1005 mouse_over_shelf_when_auto_hide_timer_started_ = false; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 if (ash::MaterialDesignController::IsShelfMaterial()) { | 1205 if (ash::MaterialDesignController::IsShelfMaterial()) { |
| 1207 return (state.visibility_state == SHELF_AUTO_HIDE && | 1206 return (state.visibility_state == SHELF_AUTO_HIDE && |
| 1208 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) | 1207 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) |
| 1209 ? 1.0f | 1208 ? 1.0f |
| 1210 : 0.0f; | 1209 : 0.0f; |
| 1211 } | 1210 } |
| 1212 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 1211 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
| 1213 } | 1212 } |
| 1214 | 1213 |
| 1215 } // namespace ash | 1214 } // namespace ash |
| OLD | NEW |