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

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

Issue 2761373002: Move yet more from WmShell 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/shelf_widget.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_controller.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) 14 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf)
15 : shelf_(shelf), stored_alignment_(shelf->GetAlignment()) { 15 : shelf_(shelf), stored_alignment_(shelf->GetAlignment()) {
16 DCHECK(shelf_); 16 DCHECK(shelf_);
17 WmShell::Get()->AddLockStateObserver(this); 17 WmShell::Get()->AddLockStateObserver(this);
18 SessionController* controller = WmShell::Get()->session_controller(); 18 SessionController* controller = Shell::Get()->session_controller();
19 session_locked_ = 19 session_locked_ =
20 controller->GetSessionState() != session_manager::SessionState::ACTIVE; 20 controller->GetSessionState() != session_manager::SessionState::ACTIVE;
21 screen_locked_ = controller->IsScreenLocked(); 21 screen_locked_ = controller->IsScreenLocked();
22 controller->AddSessionStateObserver(this); 22 controller->AddSessionStateObserver(this);
23 Shell::GetInstance()->AddShellObserver(this); 23 Shell::GetInstance()->AddShellObserver(this);
24 } 24 }
25 25
26 ShelfLockingManager::~ShelfLockingManager() { 26 ShelfLockingManager::~ShelfLockingManager() {
27 WmShell::Get()->RemoveLockStateObserver(this); 27 WmShell::Get()->RemoveLockStateObserver(this);
28 WmShell::Get()->session_controller()->RemoveSessionStateObserver(this); 28 Shell::Get()->session_controller()->RemoveSessionStateObserver(this);
29 Shell::GetInstance()->RemoveShellObserver(this); 29 Shell::GetInstance()->RemoveShellObserver(this);
30 } 30 }
31 31
32 void ShelfLockingManager::OnLockStateChanged(bool locked) { 32 void ShelfLockingManager::OnLockStateChanged(bool locked) {
33 screen_locked_ = locked; 33 screen_locked_ = locked;
34 UpdateLockedState(); 34 UpdateLockedState();
35 } 35 }
36 36
37 void ShelfLockingManager::SessionStateChanged( 37 void ShelfLockingManager::SessionStateChanged(
38 session_manager::SessionState state) { 38 session_manager::SessionState state) {
(...skipping 11 matching lines...) Expand all
50 const ShelfAlignment alignment = shelf_->GetAlignment(); 50 const ShelfAlignment alignment = shelf_->GetAlignment();
51 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { 51 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) {
52 stored_alignment_ = alignment; 52 stored_alignment_ = alignment;
53 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); 53 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED);
54 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { 54 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) {
55 shelf_->SetAlignment(stored_alignment_); 55 shelf_->SetAlignment(stored_alignment_);
56 } 56 }
57 } 57 }
58 58
59 } // namespace ash 59 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_layout_manager.cc ('k') | ash/common/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698