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

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

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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_layout_manager.h ('k') | ash/shelf/shelf_layout_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 (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/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 void ShelfLayoutManager::UpdateVisibilityState() { 308 void ShelfLayoutManager::UpdateVisibilityState() {
309 // Bail out early when there is no |workspace_controller_|, which happens 309 // Bail out early when there is no |workspace_controller_|, which happens
310 // during shutdown after PrepareForShutdown. Also bail before a shelf exists. 310 // during shutdown after PrepareForShutdown. Also bail before a shelf exists.
311 if (!workspace_controller_ || !shelf_widget_->shelf()) 311 if (!workspace_controller_ || !shelf_widget_->shelf())
312 return; 312 return;
313 313
314 if (state_.is_screen_locked || state_.is_adding_user_screen) { 314 if (state_.is_screen_locked || state_.is_adding_user_screen) {
315 SetState(SHELF_VISIBLE); 315 SetState(SHELF_VISIBLE);
316 } else if (WmShell::Get()->IsPinned()) {
317 SetState(SHELF_HIDDEN);
316 } else { 318 } else {
317 // TODO(zelidrag): Verify shelf drag animation still shows on the device 319 // TODO(zelidrag): Verify shelf drag animation still shows on the device
318 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. 320 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
319 wm::WorkspaceWindowState window_state( 321 wm::WorkspaceWindowState window_state(
320 workspace_controller_->GetWindowState()); 322 workspace_controller_->GetWindowState());
321 switch (window_state) { 323 switch (window_state) {
322 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: { 324 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: {
323 const aura::Window* fullscreen_window = GetRootWindowController( 325 const aura::Window* fullscreen_window = GetRootWindowController(
324 root_window_)->GetWindowForFullscreenMode(); 326 root_window_)->GetWindowForFullscreenMode();
325 if (fullscreen_window && wm::GetWindowState(fullscreen_window)-> 327 if (fullscreen_window && wm::GetWindowState(fullscreen_window)->
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 544
543 void ShelfLayoutManager::OnShelfAlignmentChanged(WmWindow* root_window) { 545 void ShelfLayoutManager::OnShelfAlignmentChanged(WmWindow* root_window) {
544 if (Shell::GetInstance()->in_mus()) 546 if (Shell::GetInstance()->in_mus())
545 LayoutShelf(); 547 LayoutShelf();
546 } 548 }
547 549
548 void ShelfLayoutManager::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) { 550 void ShelfLayoutManager::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) {
549 UpdateVisibilityState(); 551 UpdateVisibilityState();
550 } 552 }
551 553
554 void ShelfLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) {
555 // Shelf needs to be hidden on entering to pinned mode, or restored
556 // on exiting from pinned mode.
557 UpdateVisibilityState();
558 }
559
552 void ShelfLayoutManager::OnWindowActivated( 560 void ShelfLayoutManager::OnWindowActivated(
553 aura::client::ActivationChangeObserver::ActivationReason reason, 561 aura::client::ActivationChangeObserver::ActivationReason reason,
554 aura::Window* gained_active, 562 aura::Window* gained_active,
555 aura::Window* lost_active) { 563 aura::Window* lost_active) {
556 UpdateAutoHideStateNow(); 564 UpdateAutoHideStateNow();
557 } 565 }
558 566
559 bool ShelfLayoutManager::IsHorizontalAlignment() const { 567 bool ShelfLayoutManager::IsHorizontalAlignment() const {
560 return ::ash::IsHorizontalAlignment(GetAlignment()); 568 return ::ash::IsHorizontalAlignment(GetAlignment());
561 } 569 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 UpdateBoundsAndOpacity(target_bounds, true, NULL); 1190 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1183 UpdateVisibilityState(); 1191 UpdateVisibilityState();
1184 } 1192 }
1185 1193
1186 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { 1194 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() {
1187 UpdateVisibilityState(); 1195 UpdateVisibilityState();
1188 LayoutShelf(); 1196 LayoutShelf();
1189 } 1197 }
1190 1198
1191 } // namespace ash 1199 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698