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 | |
585 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { | 569 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
586 chromevox_panel_height_ = height; | 570 chromevox_panel_height_ = height; |
587 LayoutShelf(); | 571 LayoutShelf(); |
588 } | 572 } |
589 | 573 |
590 //////////////////////////////////////////////////////////////////////////////// | 574 //////////////////////////////////////////////////////////////////////////////// |
591 // ShelfLayoutManager, private: | 575 // ShelfLayoutManager, private: |
592 | 576 |
593 ShelfLayoutManager::TargetBounds::TargetBounds() | 577 ShelfLayoutManager::TargetBounds::TargetBounds() |
594 : opacity(0.0f), status_opacity(0.0f) {} | 578 : opacity(0.0f), status_opacity(0.0f) {} |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 target_bounds->status_bounds_in_shelf.set_x( | 946 target_bounds->status_bounds_in_shelf.set_x( |
963 target_bounds->shelf_bounds_in_root.width() - | 947 target_bounds->shelf_bounds_in_root.width() - |
964 GetShelfConstant(SHELF_SIZE)); | 948 GetShelfConstant(SHELF_SIZE)); |
965 } | 949 } |
966 } | 950 } |
967 } | 951 } |
968 | 952 |
969 void ShelfLayoutManager::UpdateShelfBackground( | 953 void ShelfLayoutManager::UpdateShelfBackground( |
970 BackgroundAnimatorChangeType type) { | 954 BackgroundAnimatorChangeType type) { |
971 const ShelfBackgroundType background_type(GetShelfBackgroundType()); | 955 const ShelfBackgroundType background_type(GetShelfBackgroundType()); |
| 956 shelf_widget_->SetPaintsBackground(background_type, type); |
972 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 957 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
973 OnBackgroundUpdated(background_type, type)); | 958 OnBackgroundUpdated(background_type, type)); |
974 } | 959 } |
975 | 960 |
| 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 |
976 void ShelfLayoutManager::UpdateAutoHideStateNow() { | 977 void ShelfLayoutManager::UpdateAutoHideStateNow() { |
977 SetState(state_.visibility_state); | 978 SetState(state_.visibility_state); |
978 | 979 |
979 // If the state did not change, the auto hide timer may still be running. | 980 // If the state did not change, the auto hide timer may still be running. |
980 StopAutoHideTimer(); | 981 StopAutoHideTimer(); |
981 } | 982 } |
982 | 983 |
983 void ShelfLayoutManager::StopAutoHideTimer() { | 984 void ShelfLayoutManager::StopAutoHideTimer() { |
984 auto_hide_timer_.Stop(); | 985 auto_hide_timer_.Stop(); |
985 mouse_over_shelf_when_auto_hide_timer_started_ = false; | 986 mouse_over_shelf_when_auto_hide_timer_started_ = false; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 if (ash::MaterialDesignController::IsShelfMaterial()) { | 1185 if (ash::MaterialDesignController::IsShelfMaterial()) { |
1185 return (state.visibility_state == SHELF_AUTO_HIDE && | 1186 return (state.visibility_state == SHELF_AUTO_HIDE && |
1186 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) | 1187 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) |
1187 ? 1.0f | 1188 ? 1.0f |
1188 : 0.0f; | 1189 : 0.0f; |
1189 } | 1190 } |
1190 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 1191 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
1191 } | 1192 } |
1192 | 1193 |
1193 } // namespace ash | 1194 } // namespace ash |
OLD | NEW |