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

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

Issue 2093283002: mash: Convert all of //ash/system to use WmShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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/system/DEPS » ('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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 UpdateVisibilityState(); 559 UpdateVisibilityState();
560 } 560 }
561 561
562 void ShelfLayoutManager::OnWindowActivated( 562 void ShelfLayoutManager::OnWindowActivated(
563 aura::client::ActivationChangeObserver::ActivationReason reason, 563 aura::client::ActivationChangeObserver::ActivationReason reason,
564 aura::Window* gained_active, 564 aura::Window* gained_active,
565 aura::Window* lost_active) { 565 aura::Window* lost_active) {
566 UpdateAutoHideStateNow(); 566 UpdateAutoHideStateNow();
567 } 567 }
568 568
569 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {
570 bool keyboard_is_about_to_hide = false;
571 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty())
572 keyboard_is_about_to_hide = true;
573
574 keyboard_bounds_ = new_bounds;
575 OnWindowResized();
576
577 SessionStateDelegate* session_state_delegate =
578 Shell::GetInstance()->session_state_delegate();
579
580 // On login screen if keyboard has been just hidden, update bounds just once
581 // but ignore target_bounds.work_area_insets since shelf overlaps with login
582 // window.
583 if (session_state_delegate->IsUserSessionBlocked() &&
584 keyboard_is_about_to_hide) {
585 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets());
586 }
587 }
588
569 bool ShelfLayoutManager::IsHorizontalAlignment() const { 589 bool ShelfLayoutManager::IsHorizontalAlignment() const {
570 return ::ash::IsHorizontalAlignment(GetAlignment()); 590 return ::ash::IsHorizontalAlignment(GetAlignment());
571 } 591 }
572 592
573 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { 593 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) {
574 chromevox_panel_height_ = height; 594 chromevox_panel_height_ = height;
575 LayoutShelf(); 595 LayoutShelf();
576 } 596 }
577 597
578 //////////////////////////////////////////////////////////////////////////////// 598 ////////////////////////////////////////////////////////////////////////////////
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } 1148 }
1129 1149
1130 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { 1150 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const {
1131 if (state.visibility_state == SHELF_VISIBLE) 1151 if (state.visibility_state == SHELF_VISIBLE)
1132 return size; 1152 return size;
1133 if (state.visibility_state == SHELF_AUTO_HIDE) 1153 if (state.visibility_state == SHELF_AUTO_HIDE)
1134 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); 1154 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
1135 return 0; 1155 return 0;
1136 } 1156 }
1137 1157
1138 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {
1139 bool keyboard_is_about_to_hide = false;
1140 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty())
1141 keyboard_is_about_to_hide = true;
1142
1143 keyboard_bounds_ = new_bounds;
1144 OnWindowResized();
1145
1146 SessionStateDelegate* session_state_delegate =
1147 Shell::GetInstance()->session_state_delegate();
1148
1149 // On login screen if keyboard has been just hidden, update bounds just once
1150 // but ignore target_bounds.work_area_insets since shelf overlaps with login
1151 // window.
1152 if (session_state_delegate->IsUserSessionBlocked() &&
1153 keyboard_is_about_to_hide) {
1154 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets());
1155 }
1156 }
1157
1158 void ShelfLayoutManager::OnDockBoundsChanging( 1158 void ShelfLayoutManager::OnDockBoundsChanging(
1159 const gfx::Rect& dock_bounds, 1159 const gfx::Rect& dock_bounds,
1160 DockedWindowLayoutManagerObserver::Reason reason) { 1160 DockedWindowLayoutManagerObserver::Reason reason) {
1161 // Skip shelf layout in case docked notification originates from this class. 1161 // Skip shelf layout in case docked notification originates from this class.
1162 if (reason == DISPLAY_INSETS_CHANGED) 1162 if (reason == DISPLAY_INSETS_CHANGED)
1163 return; 1163 return;
1164 if (dock_bounds_ != dock_bounds) { 1164 if (dock_bounds_ != dock_bounds) {
1165 dock_bounds_ = dock_bounds; 1165 dock_bounds_ = dock_bounds;
1166 OnWindowResized(); 1166 OnWindowResized();
1167 UpdateVisibilityState(); 1167 UpdateVisibilityState();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 if (ash::MaterialDesignController::IsShelfMaterial()) { 1210 if (ash::MaterialDesignController::IsShelfMaterial()) {
1211 return (state.visibility_state == SHELF_AUTO_HIDE && 1211 return (state.visibility_state == SHELF_AUTO_HIDE &&
1212 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) 1212 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)
1213 ? 1.0f 1213 ? 1.0f
1214 : 0.0f; 1214 : 0.0f;
1215 } 1215 }
1216 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; 1216 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f;
1217 } 1217 }
1218 1218
1219 } // namespace ash 1219 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/system/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698