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