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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && | 559 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && |
560 keyboard_is_about_to_hide) { | 560 keyboard_is_about_to_hide) { |
561 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); | 561 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); |
562 } | 562 } |
563 } | 563 } |
564 | 564 |
565 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 565 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
566 return ::ash::IsHorizontalAlignment(GetAlignment()); | 566 return ::ash::IsHorizontalAlignment(GetAlignment()); |
567 } | 567 } |
568 | 568 |
| 569 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
| 570 if (state_.visibility_state != SHELF_AUTO_HIDE && |
| 571 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
| 572 return SHELF_BACKGROUND_MAXIMIZED; |
| 573 } |
| 574 |
| 575 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
| 576 (!state_.is_screen_locked && !state_.is_adding_user_screen && |
| 577 window_overlaps_shelf_) || |
| 578 (state_.visibility_state == SHELF_AUTO_HIDE)) { |
| 579 return SHELF_BACKGROUND_OVERLAP; |
| 580 } |
| 581 |
| 582 return SHELF_BACKGROUND_DEFAULT; |
| 583 } |
| 584 |
569 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { | 585 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
570 chromevox_panel_height_ = height; | 586 chromevox_panel_height_ = height; |
571 LayoutShelf(); | 587 LayoutShelf(); |
572 } | 588 } |
573 | 589 |
574 //////////////////////////////////////////////////////////////////////////////// | 590 //////////////////////////////////////////////////////////////////////////////// |
575 // ShelfLayoutManager, private: | 591 // ShelfLayoutManager, private: |
576 | 592 |
577 ShelfLayoutManager::TargetBounds::TargetBounds() | 593 ShelfLayoutManager::TargetBounds::TargetBounds() |
578 : opacity(0.0f), status_opacity(0.0f) {} | 594 : opacity(0.0f), status_opacity(0.0f) {} |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 target_bounds->status_bounds_in_shelf.set_x( | 962 target_bounds->status_bounds_in_shelf.set_x( |
947 target_bounds->shelf_bounds_in_root.width() - | 963 target_bounds->shelf_bounds_in_root.width() - |
948 GetShelfConstant(SHELF_SIZE)); | 964 GetShelfConstant(SHELF_SIZE)); |
949 } | 965 } |
950 } | 966 } |
951 } | 967 } |
952 | 968 |
953 void ShelfLayoutManager::UpdateShelfBackground( | 969 void ShelfLayoutManager::UpdateShelfBackground( |
954 BackgroundAnimatorChangeType type) { | 970 BackgroundAnimatorChangeType type) { |
955 const ShelfBackgroundType background_type(GetShelfBackgroundType()); | 971 const ShelfBackgroundType background_type(GetShelfBackgroundType()); |
956 shelf_widget_->SetPaintsBackground(background_type, type); | |
957 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 972 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
958 OnBackgroundUpdated(background_type, type)); | 973 OnBackgroundUpdated(background_type, type)); |
959 } | 974 } |
960 | 975 |
961 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | |
962 if (state_.visibility_state != SHELF_AUTO_HIDE && | |
963 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | |
964 return SHELF_BACKGROUND_MAXIMIZED; | |
965 } | |
966 | |
967 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | |
968 (!state_.is_screen_locked && !state_.is_adding_user_screen && | |
969 window_overlaps_shelf_) || | |
970 (state_.visibility_state == SHELF_AUTO_HIDE)) { | |
971 return SHELF_BACKGROUND_OVERLAP; | |
972 } | |
973 | |
974 return SHELF_BACKGROUND_DEFAULT; | |
975 } | |
976 | |
977 void ShelfLayoutManager::UpdateAutoHideStateNow() { | 976 void ShelfLayoutManager::UpdateAutoHideStateNow() { |
978 SetState(state_.visibility_state); | 977 SetState(state_.visibility_state); |
979 | 978 |
980 // If the state did not change, the auto hide timer may still be running. | 979 // If the state did not change, the auto hide timer may still be running. |
981 StopAutoHideTimer(); | 980 StopAutoHideTimer(); |
982 } | 981 } |
983 | 982 |
984 void ShelfLayoutManager::StopAutoHideTimer() { | 983 void ShelfLayoutManager::StopAutoHideTimer() { |
985 auto_hide_timer_.Stop(); | 984 auto_hide_timer_.Stop(); |
986 mouse_over_shelf_when_auto_hide_timer_started_ = false; | 985 mouse_over_shelf_when_auto_hide_timer_started_ = false; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 if (ash::MaterialDesignController::IsShelfMaterial()) { | 1184 if (ash::MaterialDesignController::IsShelfMaterial()) { |
1186 return (state.visibility_state == SHELF_AUTO_HIDE && | 1185 return (state.visibility_state == SHELF_AUTO_HIDE && |
1187 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) | 1186 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) |
1188 ? 1.0f | 1187 ? 1.0f |
1189 : 0.0f; | 1188 : 0.0f; |
1190 } | 1189 } |
1191 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 1190 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
1192 } | 1191 } |
1193 | 1192 |
1194 } // namespace ash | 1193 } // namespace ash |
OLD | NEW |