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