Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ash/common/shelf/shelf_locking_manager.cc

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: merge Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/shelf/shelf_layout_manager.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_state_delegate.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 11
11 namespace ash { 12 namespace ash {
12 13
13 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf) : shelf_(shelf) { 14 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf) : shelf_(shelf) {
14 WmShell::Get()->AddLockStateObserver(this); 15 WmShell::Get()->AddLockStateObserver(this);
15 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); 16 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
16 session_locked_ = 17 session_locked_ =
17 delegate->GetSessionState() != session_manager::SessionState::ACTIVE; 18 delegate->GetSessionState() != session_manager::SessionState::ACTIVE;
18 screen_locked_ = delegate->IsScreenLocked(); 19 screen_locked_ = delegate->IsScreenLocked();
19 delegate->AddSessionStateObserver(this); 20 delegate->AddSessionStateObserver(this);
20 WmShell::Get()->AddShellObserver(this); 21 Shell::GetInstance()->AddShellObserver(this);
21 } 22 }
22 23
23 ShelfLockingManager::~ShelfLockingManager() { 24 ShelfLockingManager::~ShelfLockingManager() {
24 WmShell::Get()->RemoveLockStateObserver(this); 25 WmShell::Get()->RemoveLockStateObserver(this);
25 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this); 26 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this);
26 WmShell::Get()->RemoveShellObserver(this); 27 Shell::GetInstance()->RemoveShellObserver(this);
27 } 28 }
28 29
29 void ShelfLockingManager::OnLockStateChanged(bool locked) { 30 void ShelfLockingManager::OnLockStateChanged(bool locked) {
30 screen_locked_ = locked; 31 screen_locked_ = locked;
31 UpdateLockedState(); 32 UpdateLockedState();
32 } 33 }
33 34
34 void ShelfLockingManager::SessionStateChanged( 35 void ShelfLockingManager::SessionStateChanged(
35 session_manager::SessionState state) { 36 session_manager::SessionState state) {
36 session_locked_ = state != session_manager::SessionState::ACTIVE; 37 session_locked_ = state != session_manager::SessionState::ACTIVE;
(...skipping 10 matching lines...) Expand all
47 const ShelfAlignment alignment = shelf_->GetAlignment(); 48 const ShelfAlignment alignment = shelf_->GetAlignment();
48 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { 49 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) {
49 stored_alignment_ = alignment; 50 stored_alignment_ = alignment;
50 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); 51 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED);
51 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { 52 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) {
52 shelf_->SetAlignment(stored_alignment_); 53 shelf_->SetAlignment(stored_alignment_);
53 } 54 }
54 } 55 }
55 56
56 } // namespace ash 57 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_layout_manager.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698