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

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: rebase 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
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 (state_.is_pinned) {
oshima 2016/06/18 04:47:44 can't we just use WmShell::Get()->IsPinned()?
hidehiko 2016/06/18 05:32:45 Ditto for workspalce_layout_manager.
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 state_.is_pinned = pinned_window->GetWindowState()->IsPinned();
556 UpdateVisibilityState();
557 }
558
552 void ShelfLayoutManager::OnWindowActivated( 559 void ShelfLayoutManager::OnWindowActivated(
553 aura::client::ActivationChangeObserver::ActivationReason reason, 560 aura::client::ActivationChangeObserver::ActivationReason reason,
554 aura::Window* gained_active, 561 aura::Window* gained_active,
555 aura::Window* lost_active) { 562 aura::Window* lost_active) {
556 UpdateAutoHideStateNow(); 563 UpdateAutoHideStateNow();
557 } 564 }
558 565
559 bool ShelfLayoutManager::IsHorizontalAlignment() const { 566 bool ShelfLayoutManager::IsHorizontalAlignment() const {
560 return ::ash::IsHorizontalAlignment(GetAlignment()); 567 return ::ash::IsHorizontalAlignment(GetAlignment());
561 } 568 }
(...skipping 17 matching lines...) Expand all
579 586
580 State state; 587 State state;
581 state.visibility_state = visibility_state; 588 state.visibility_state = visibility_state;
582 state.auto_hide_state = CalculateAutoHideState(visibility_state); 589 state.auto_hide_state = CalculateAutoHideState(visibility_state);
583 state.window_state = workspace_controller_ 590 state.window_state = workspace_controller_
584 ? workspace_controller_->GetWindowState() 591 ? workspace_controller_->GetWindowState()
585 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; 592 : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
586 // Preserve the log in screen states. 593 // Preserve the log in screen states.
587 state.is_adding_user_screen = state_.is_adding_user_screen; 594 state.is_adding_user_screen = state_.is_adding_user_screen;
588 state.is_screen_locked = state_.is_screen_locked; 595 state.is_screen_locked = state_.is_screen_locked;
596 state.is_pinned = state_.is_pinned;
589 597
590 // Force an update because gesture drags affect the shelf bounds and we 598 // Force an update because gesture drags affect the shelf bounds and we
591 // should animate back to the normal bounds at the end of a gesture. 599 // should animate back to the normal bounds at the end of a gesture.
592 bool force_update = 600 bool force_update =
593 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS || 601 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS ||
594 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); 602 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS);
595 603
596 if (!force_update && state_.Equals(state)) 604 if (!force_update && state_.Equals(state))
597 return; // Nothing changed. 605 return; // Nothing changed.
598 606
(...skipping 583 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

Powered by Google App Engine
This is Rietveld 408576698