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

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

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 7 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/shelf/shelf_locking_manager.h ('k') | ash/shelf/shelf_locking_manager_unittest.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/shelf/shelf_locking_manager.h" 5 #include "ash/shelf/shelf_locking_manager.h"
6 6
7 #include "ash/session/session_controller.h" 7 #include "ash/session/session_controller.h"
8 #include "ash/shelf/wm_shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_port.h" 10 #include "ash/shell_port.h"
11 11
12 namespace ash { 12 namespace ash {
13 13
14 ShelfLockingManager::ShelfLockingManager(WmShelf* shelf) 14 ShelfLockingManager::ShelfLockingManager(Shelf* shelf)
15 : shelf_(shelf), 15 : shelf_(shelf),
16 stored_alignment_(SHELF_ALIGNMENT_BOTTOM_LOCKED), 16 stored_alignment_(SHELF_ALIGNMENT_BOTTOM_LOCKED),
17 scoped_session_observer_(this) { 17 scoped_session_observer_(this) {
18 DCHECK(shelf_); 18 DCHECK(shelf_);
19 ShellPort::Get()->AddLockStateObserver(this); 19 ShellPort::Get()->AddLockStateObserver(this);
20 SessionController* controller = Shell::Get()->session_controller(); 20 SessionController* controller = Shell::Get()->session_controller();
21 session_locked_ = 21 session_locked_ =
22 controller->GetSessionState() != session_manager::SessionState::ACTIVE; 22 controller->GetSessionState() != session_manager::SessionState::ACTIVE;
23 screen_locked_ = controller->IsScreenLocked(); 23 screen_locked_ = controller->IsScreenLocked();
24 } 24 }
(...skipping 13 matching lines...) Expand all
38 UpdateLockedState(); 38 UpdateLockedState();
39 } 39 }
40 40
41 void ShelfLockingManager::OnLockStateEvent(EventType event) { 41 void ShelfLockingManager::OnLockStateEvent(EventType event) {
42 // Lock when the animation starts, ignoring pre-lock. There's no unlock event. 42 // Lock when the animation starts, ignoring pre-lock. There's no unlock event.
43 screen_locked_ |= event == EVENT_LOCK_ANIMATION_STARTED; 43 screen_locked_ |= event == EVENT_LOCK_ANIMATION_STARTED;
44 UpdateLockedState(); 44 UpdateLockedState();
45 } 45 }
46 46
47 void ShelfLockingManager::UpdateLockedState() { 47 void ShelfLockingManager::UpdateLockedState() {
48 const ShelfAlignment alignment = shelf_->GetAlignment(); 48 const ShelfAlignment alignment = shelf_->alignment();
49 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { 49 if (is_locked() && alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) {
50 stored_alignment_ = alignment; 50 stored_alignment_ = alignment;
51 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED); 51 shelf_->SetAlignment(SHELF_ALIGNMENT_BOTTOM_LOCKED);
52 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { 52 } else if (!is_locked() && alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) {
53 shelf_->SetAlignment(stored_alignment_); 53 shelf_->SetAlignment(stored_alignment_);
54 } 54 }
55 } 55 }
56 56
57 } // namespace ash 57 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_locking_manager.h ('k') | ash/shelf/shelf_locking_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698