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

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

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase to get WorkspaceLayoutManagerSoloTest change 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/session/session_state_observer.cc ('k') | ash/common/shelf/shelf_locking_manager.h » ('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 (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/common/shelf/shelf_layout_manager.h" 5 #include "ash/common/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
11 #include "ash/animation/animation_change_type.h" 11 #include "ash/animation/animation_change_type.h"
12 #include "ash/common/keyboard/keyboard_observer_register.h" 12 #include "ash/common/keyboard/keyboard_observer_register.h"
13 #include "ash/common/session/session_controller.h" 13 #include "ash/common/session/session_controller.h"
14 #include "ash/common/session/session_state_delegate.h"
15 #include "ash/common/shelf/shelf_constants.h" 14 #include "ash/common/shelf/shelf_constants.h"
16 #include "ash/common/shelf/shelf_layout_manager_observer.h" 15 #include "ash/common/shelf/shelf_layout_manager_observer.h"
17 #include "ash/common/shelf/shelf_widget.h" 16 #include "ash/common/shelf/shelf_widget.h"
18 #include "ash/common/shelf/wm_shelf.h" 17 #include "ash/common/shelf/wm_shelf.h"
19 #include "ash/common/system/status_area_widget.h" 18 #include "ash/common/system/status_area_widget.h"
20 #include "ash/common/wm/fullscreen_window_finder.h" 19 #include "ash/common/wm/fullscreen_window_finder.h"
21 #include "ash/common/wm/mru_window_tracker.h" 20 #include "ash/common/wm/mru_window_tracker.h"
22 #include "ash/common/wm/window_state.h" 21 #include "ash/common/wm/window_state.h"
23 #include "ash/common/wm/wm_screen_util.h" 22 #include "ash/common/wm/wm_screen_util.h"
24 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { 333 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) {
335 observers_.AddObserver(observer); 334 observers_.AddObserver(observer);
336 } 335 }
337 336
338 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { 337 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) {
339 observers_.RemoveObserver(observer); 338 observers_.RemoveObserver(observer);
340 } 339 }
341 340
342 bool ShelfLayoutManager::ProcessGestureEvent(const ui::GestureEvent& event) { 341 bool ShelfLayoutManager::ProcessGestureEvent(const ui::GestureEvent& event) {
343 // The gestures are disabled in the lock/login screen. 342 // The gestures are disabled in the lock/login screen.
344 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); 343 SessionController* controller = WmShell::Get()->session_controller();
345 if (!delegate->NumberOfLoggedInUsers() || delegate->IsScreenLocked()) 344 if (!controller->NumberOfLoggedInUsers() || controller->IsScreenLocked())
346 return false; 345 return false;
347 346
348 if (IsShelfHiddenForFullscreen()) 347 if (IsShelfHiddenForFullscreen())
349 return false; 348 return false;
350 349
351 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { 350 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) {
352 StartGestureDrag(event); 351 StartGestureDrag(event);
353 return true; 352 return true;
354 } 353 }
355 354
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 (!base::CommandLine::ForCurrentProcess()->HasSwitch( 430 (!base::CommandLine::ForCurrentProcess()->HasSwitch(
432 ::switches::kUseNewVirtualKeyboardBehavior) || 431 ::switches::kUseNewVirtualKeyboardBehavior) ||
433 keyboard::KeyboardController::GetInstance()->keyboard_locked()); 432 keyboard::KeyboardController::GetInstance()->keyboard_locked());
434 433
435 keyboard_bounds_ = new_bounds; 434 keyboard_bounds_ = new_bounds;
436 LayoutShelfAndUpdateBounds(change_work_area); 435 LayoutShelfAndUpdateBounds(change_work_area);
437 436
438 // On login screen if keyboard has been just hidden, update bounds just once 437 // On login screen if keyboard has been just hidden, update bounds just once
439 // but ignore target_bounds.work_area_insets since shelf overlaps with login 438 // but ignore target_bounds.work_area_insets since shelf overlaps with login
440 // window. 439 // window.
441 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && 440 if (WmShell::Get()->session_controller()->IsUserSessionBlocked() &&
442 keyboard_is_about_to_hide) { 441 keyboard_is_about_to_hide) {
443 WmWindow* window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 442 WmWindow* window = WmWindow::Get(shelf_widget_->GetNativeWindow());
444 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets()); 443 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets());
445 } 444 }
446 } 445 }
447 446
448 void ShelfLayoutManager::OnKeyboardClosed() { 447 void ShelfLayoutManager::OnKeyboardClosed() {
449 keyboard_observer_.RemoveAll(); 448 keyboard_observer_.RemoveAll();
450 } 449 }
451 450
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 gesture_drag_status_ = GESTURE_DRAG_NONE; 1148 gesture_drag_status_ = GESTURE_DRAG_NONE;
1150 } 1149 }
1151 1150
1152 void ShelfLayoutManager::CancelGestureDrag() { 1151 void ShelfLayoutManager::CancelGestureDrag() {
1153 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 1152 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
1154 UpdateVisibilityState(); 1153 UpdateVisibilityState();
1155 gesture_drag_status_ = GESTURE_DRAG_NONE; 1154 gesture_drag_status_ = GESTURE_DRAG_NONE;
1156 } 1155 }
1157 1156
1158 } // namespace ash 1157 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/session/session_state_observer.cc ('k') | ash/common/shelf/shelf_locking_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698