Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/shelf/shelf_locking_manager.h" | 5 #include "ash/common/shelf/shelf_locking_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_controller.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf) : shelf_(shelf) { | 14 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf) |
| 15 : shelf_(shelf), stored_alignment_(shelf->GetAlignment()) { | |
|
xiyuan
2017/03/17 07:08:15
Initialize |stored_alignment_| with the current al
James Cook
2017/03/17 17:14:35
msw, can you look at this piece of the CL? I think
msw
2017/03/17 18:10:46
This small part of the change lgtm (with James' su
xiyuan
2017/03/17 22:52:02
Removed initialization from header and added DCHEC
| |
| 15 WmShell::Get()->AddLockStateObserver(this); | 16 WmShell::Get()->AddLockStateObserver(this); |
| 16 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); | 17 SessionController* controller = WmShell::Get()->session_controller(); |
| 17 session_locked_ = | 18 session_locked_ = |
| 18 delegate->GetSessionState() != session_manager::SessionState::ACTIVE; | 19 controller->GetSessionState() != session_manager::SessionState::ACTIVE; |
| 19 screen_locked_ = delegate->IsScreenLocked(); | 20 screen_locked_ = controller->IsScreenLocked(); |
| 20 delegate->AddSessionStateObserver(this); | 21 controller->AddSessionStateObserver(this); |
| 21 Shell::GetInstance()->AddShellObserver(this); | 22 Shell::GetInstance()->AddShellObserver(this); |
| 22 } | 23 } |
| 23 | 24 |
| 24 ShelfLockingManager::~ShelfLockingManager() { | 25 ShelfLockingManager::~ShelfLockingManager() { |
| 25 WmShell::Get()->RemoveLockStateObserver(this); | 26 WmShell::Get()->RemoveLockStateObserver(this); |
| 26 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this); | 27 WmShell::Get()->session_controller()->RemoveSessionStateObserver(this); |
| 27 Shell::GetInstance()->RemoveShellObserver(this); | 28 Shell::GetInstance()->RemoveShellObserver(this); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void ShelfLockingManager::OnLockStateChanged(bool locked) { | 31 void ShelfLockingManager::OnLockStateChanged(bool locked) { |
| 31 screen_locked_ = locked; | 32 screen_locked_ = locked; |
| 32 UpdateLockedState(); | 33 UpdateLockedState(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 void ShelfLockingManager::SessionStateChanged( | 36 void ShelfLockingManager::SessionStateChanged( |
| 36 session_manager::SessionState state) { | 37 session_manager::SessionState state) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 48 const ShelfAlignment alignment = shelf_->GetAlignment(); | 49 const ShelfAlignment alignment = shelf_->GetAlignment(); |
| 49 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 50 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
| 50 stored_alignment_ = alignment; | 51 stored_alignment_ = alignment; |
| 51 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); | 52 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); |
| 52 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 53 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
| 53 shelf_->SetAlignment(stored_alignment_); | 54 shelf_->SetAlignment(stored_alignment_); |
| 54 } | 55 } |
| 55 } | 56 } |
| 56 | 57 |
| 57 } // namespace ash | 58 } // namespace ash |
| OLD | NEW |