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_layout_manager.cc

Issue 2782223002: Add ability to have active window autohide shelf (Closed)
Patch Set: Add ability to have active window autohide shelf Created 3 years, 8 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 | « no previous file | ash/common/wm/window_state.h » ('j') | ash/common/wm/window_state.h » ('J')
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/shelf/shelf_constants.h" 14 #include "ash/common/shelf/shelf_constants.h"
15 #include "ash/common/shelf/shelf_layout_manager_observer.h" 15 #include "ash/common/shelf/shelf_layout_manager_observer.h"
16 #include "ash/common/shelf/shelf_widget.h" 16 #include "ash/common/shelf/shelf_widget.h"
17 #include "ash/common/shelf/wm_shelf.h" 17 #include "ash/common/shelf/wm_shelf.h"
18 #include "ash/common/system/status_area_widget.h" 18 #include "ash/common/system/status_area_widget.h"
19 #include "ash/common/wm/fullscreen_window_finder.h" 19 #include "ash/common/wm/fullscreen_window_finder.h"
20 #include "ash/common/wm/mru_window_tracker.h" 20 #include "ash/common/wm/mru_window_tracker.h"
21 #include "ash/common/wm/window_state.h" 21 #include "ash/common/wm/window_state.h"
22 #include "ash/common/wm/wm_screen_util.h" 22 #include "ash/common/wm/wm_screen_util.h"
23 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
25 #include "ash/public/cpp/shell_window_ids.h" 25 #include "ash/public/cpp/shell_window_ids.h"
26 #include "ash/root_window_controller.h" 26 #include "ash/root_window_controller.h"
27 #include "ash/shell.h" 27 #include "ash/shell.h"
28 #include "ash/wm/window_state_aura.h"
28 #include "base/auto_reset.h" 29 #include "base/auto_reset.h"
29 #include "base/command_line.h" 30 #include "base/command_line.h"
30 #include "base/i18n/rtl.h" 31 #include "base/i18n/rtl.h"
31 #include "ui/base/ui_base_switches.h" 32 #include "ui/base/ui_base_switches.h"
32 #include "ui/compositor/layer.h" 33 #include "ui/compositor/layer.h"
33 #include "ui/compositor/layer_animation_observer.h" 34 #include "ui/compositor/layer_animation_observer.h"
34 #include "ui/compositor/layer_animator.h" 35 #include "ui/compositor/layer_animator.h"
35 #include "ui/compositor/scoped_layer_animation_settings.h" 36 #include "ui/compositor/scoped_layer_animation_settings.h"
36 #include "ui/display/display.h" 37 #include "ui/display/display.h"
37 #include "ui/display/screen.h" 38 #include "ui/display/screen.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void ShelfLayoutManager::UpdateVisibilityState() { 237 void ShelfLayoutManager::UpdateVisibilityState() {
237 // Bail out early before the shelf is initialized or after it is destroyed. 238 // Bail out early before the shelf is initialized or after it is destroyed.
238 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 239 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow());
239 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window) 240 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window)
240 return; 241 return;
241 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { 242 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) {
242 SetState(SHELF_VISIBLE); 243 SetState(SHELF_VISIBLE);
243 } else if (WmShell::Get()->IsPinned()) { 244 } else if (WmShell::Get()->IsPinned()) {
244 SetState(SHELF_HIDDEN); 245 SetState(SHELF_HIDDEN);
245 } else { 246 } else {
247 wm::WindowState* active_window = wm::GetActiveWindowState();
248
249 if (active_window && active_window->hide_shelf_when_active()) {
250 SetState(SHELF_AUTO_HIDE);
251 return;
252 }
oshima 2017/03/30 14:01:27 This should happen only when the WORKSPACE_WINDOW_
yorkelee 2017/03/30 19:34:12 Done.
253
246 // TODO(zelidrag): Verify shelf drag animation still shows on the device 254 // TODO(zelidrag): Verify shelf drag animation still shows on the device
247 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. 255 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
248 wm::WorkspaceWindowState window_state( 256 wm::WorkspaceWindowState window_state(
249 shelf_window->GetRootWindowController()->GetWorkspaceWindowState()); 257 shelf_window->GetRootWindowController()->GetWorkspaceWindowState());
250 switch (window_state) { 258 switch (window_state) {
251 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: { 259 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: {
252 if (IsShelfHiddenForFullscreen()) { 260 if (IsShelfHiddenForFullscreen()) {
253 SetState(SHELF_HIDDEN); 261 SetState(SHELF_HIDDEN);
254 } else { 262 } else {
255 // The shelf is sometimes not hidden when in immersive fullscreen. 263 // The shelf is sometimes not hidden when in immersive fullscreen.
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 gesture_drag_status_ = GESTURE_DRAG_NONE; 1133 gesture_drag_status_ = GESTURE_DRAG_NONE;
1126 } 1134 }
1127 1135
1128 void ShelfLayoutManager::CancelGestureDrag() { 1136 void ShelfLayoutManager::CancelGestureDrag() {
1129 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 1137 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
1130 UpdateVisibilityState(); 1138 UpdateVisibilityState();
1131 gesture_drag_status_ = GESTURE_DRAG_NONE; 1139 gesture_drag_status_ = GESTURE_DRAG_NONE;
1132 } 1140 }
1133 1141
1134 } // namespace ash 1142 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/window_state.h » ('j') | ash/common/wm/window_state.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698