| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ShelfLayoutManager::~ShelfLayoutManager() { | 167 ShelfLayoutManager::~ShelfLayoutManager() { |
| 168 if (update_shelf_observer_) | 168 if (update_shelf_observer_) |
| 169 update_shelf_observer_->Detach(); | 169 update_shelf_observer_->Detach(); |
| 170 | 170 |
| 171 for (auto& observer : observers_) | 171 for (auto& observer : observers_) |
| 172 observer.WillDeleteShelfLayoutManager(); | 172 observer.WillDeleteShelfLayoutManager(); |
| 173 Shell::Get()->RemoveShellObserver(this); | 173 Shell::Get()->RemoveShellObserver(this); |
| 174 ShellPort::Get()->RemoveLockStateObserver(this); | 174 ShellPort::Get()->RemoveLockStateObserver(this); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ShelfLayoutManager::OnAppListIsActive(bool is_active) { |
| 178 app_list_is_active_ = is_active; |
| 179 MaybeUpdateShelfBackground(AnimationChangeType::IMMEDIATE); |
| 180 } |
| 181 |
| 177 void ShelfLayoutManager::PrepareForShutdown() { | 182 void ShelfLayoutManager::PrepareForShutdown() { |
| 178 in_shutdown_ = true; | 183 in_shutdown_ = true; |
| 179 // Stop observing changes to avoid updating a partially destructed shelf. | 184 // Stop observing changes to avoid updating a partially destructed shelf. |
| 180 Shell::Get()->activation_client()->RemoveObserver(this); | 185 Shell::Get()->activation_client()->RemoveObserver(this); |
| 181 } | 186 } |
| 182 | 187 |
| 183 bool ShelfLayoutManager::IsVisible() const { | 188 bool ShelfLayoutManager::IsVisible() const { |
| 184 // status_area_widget() may be nullptr during the shutdown. | 189 // status_area_widget() may be nullptr during the shutdown. |
| 185 return shelf_widget_->status_area_widget() && | 190 return shelf_widget_->status_area_widget() && |
| 186 shelf_widget_->status_area_widget()->IsVisible() && | 191 shelf_widget_->status_area_widget()->IsVisible() && |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 467 } |
| 463 | 468 |
| 464 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 469 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
| 465 if (state_.pre_lock_screen_animation_active) | 470 if (state_.pre_lock_screen_animation_active) |
| 466 return SHELF_BACKGROUND_DEFAULT; | 471 return SHELF_BACKGROUND_DEFAULT; |
| 467 | 472 |
| 468 // Handle all non active screen states, including OOBE and pre-login. | 473 // Handle all non active screen states, including OOBE and pre-login. |
| 469 if (state_.session_state != session_manager::SessionState::ACTIVE) | 474 if (state_.session_state != session_manager::SessionState::ACTIVE) |
| 470 return SHELF_BACKGROUND_OVERLAP; | 475 return SHELF_BACKGROUND_OVERLAP; |
| 471 | 476 |
| 477 // If the app list is active, hide the shelf background to prevent overlap. |
| 478 if (app_list_is_active_) |
| 479 return SHELF_BACKGROUND_DEFAULT; |
| 480 |
| 472 if (state_.visibility_state != SHELF_AUTO_HIDE && | 481 if (state_.visibility_state != SHELF_AUTO_HIDE && |
| 473 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | 482 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
| 474 return SHELF_BACKGROUND_MAXIMIZED; | 483 return SHELF_BACKGROUND_MAXIMIZED; |
| 475 } | 484 } |
| 476 | 485 |
| 477 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 486 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
| 478 window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { | 487 window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { |
| 479 return SHELF_BACKGROUND_OVERLAP; | 488 return SHELF_BACKGROUND_OVERLAP; |
| 480 } | 489 } |
| 481 | 490 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1164 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1156 } | 1165 } |
| 1157 | 1166 |
| 1158 void ShelfLayoutManager::CancelGestureDrag() { | 1167 void ShelfLayoutManager::CancelGestureDrag() { |
| 1159 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1168 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
| 1160 UpdateVisibilityState(); | 1169 UpdateVisibilityState(); |
| 1161 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1170 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1162 } | 1171 } |
| 1163 | 1172 |
| 1164 } // namespace ash | 1173 } // namespace ash |
| OLD | NEW |