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

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

Issue 231123002: Notify about major session changes events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_tests Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/test/test_session_state_delegate.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/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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 mouse_over_shelf_when_auto_hide_timer_started_(false), 198 mouse_over_shelf_when_auto_hide_timer_started_(false),
199 bezel_event_filter_(new ShelfBezelEventFilter(this)), 199 bezel_event_filter_(new ShelfBezelEventFilter(this)),
200 gesture_drag_status_(GESTURE_DRAG_NONE), 200 gesture_drag_status_(GESTURE_DRAG_NONE),
201 gesture_drag_amount_(0.f), 201 gesture_drag_amount_(0.f),
202 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), 202 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
203 update_shelf_observer_(NULL), 203 update_shelf_observer_(NULL),
204 duration_override_in_ms_(0) { 204 duration_override_in_ms_(0) {
205 Shell::GetInstance()->AddShellObserver(this); 205 Shell::GetInstance()->AddShellObserver(this);
206 Shell::GetInstance()->lock_state_controller()->AddObserver(this); 206 Shell::GetInstance()->lock_state_controller()->AddObserver(this);
207 aura::client::GetActivationClient(root_window_)->AddObserver(this); 207 aura::client::GetActivationClient(root_window_)->AddObserver(this);
208 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
208 } 209 }
209 210
210 ShelfLayoutManager::~ShelfLayoutManager() { 211 ShelfLayoutManager::~ShelfLayoutManager() {
211 if (update_shelf_observer_) 212 if (update_shelf_observer_)
212 update_shelf_observer_->Detach(); 213 update_shelf_observer_->Detach();
213 214
214 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); 215 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf());
215 Shell::GetInstance()->RemoveShellObserver(this); 216 Shell::GetInstance()->RemoveShellObserver(this);
216 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); 217 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this);
217 aura::client::GetActivationClient(root_window_)->RemoveObserver(this); 218 aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
219 Shell::GetInstance()->
220 session_state_delegate()->RemoveSessionStateObserver(this);
218 } 221 }
219 222
220 void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { 223 void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
221 if (auto_hide_behavior_ == behavior) 224 if (auto_hide_behavior_ == behavior)
222 return; 225 return;
223 auto_hide_behavior_ = behavior; 226 auto_hide_behavior_ = behavior;
224 UpdateVisibilityState(); 227 UpdateVisibilityState();
225 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 228 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
226 OnAutoHideBehaviorChanged(root_window_, 229 OnAutoHideBehaviorChanged(root_window_,
227 auto_hide_behavior_)); 230 auto_hide_behavior_));
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 status_bounds.set_x(status_bounds.x() + 728 status_bounds.set_x(status_bounds.x() +
726 target_bounds.shelf_bounds_in_root.x()); 729 target_bounds.shelf_bounds_in_root.x());
727 status_bounds.set_y(status_bounds.y() + 730 status_bounds.set_y(status_bounds.y() +
728 target_bounds.shelf_bounds_in_root.y()); 731 target_bounds.shelf_bounds_in_root.y());
729 shelf_->status_area_widget()->SetBounds( 732 shelf_->status_area_widget()->SetBounds(
730 ScreenUtil::ConvertRectToScreen( 733 ScreenUtil::ConvertRectToScreen(
731 shelf_->status_area_widget()->GetNativeView()->parent(), 734 shelf_->status_area_widget()->GetNativeView()->parent(),
732 status_bounds)); 735 status_bounds));
733 SessionStateDelegate* session_state_delegate = 736 SessionStateDelegate* session_state_delegate =
734 Shell::GetInstance()->session_state_delegate(); 737 Shell::GetInstance()->session_state_delegate();
735 if (!state_.is_screen_locked && 738 if (!state_.is_screen_locked) {
736 (session_state_delegate->IsActiveUserSessionStarted() || 739 gfx::Insets insets;
737 !keyboard_bounds_.IsEmpty())) { 740 // If user session is blocked (login to new user session or add user to
738 Shell::GetInstance()->SetDisplayWorkAreaInsets( 741 // the existing session - multi-profile) then give 100% of work area only if
739 root_window_, target_bounds.work_area_insets); 742 // keyboard is not shown.
743 if (!session_state_delegate->IsUserSessionBlocked() ||
744 !keyboard_bounds_.IsEmpty()) {
745 insets = target_bounds.work_area_insets;
746 }
747 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, insets);
740 } 748 }
741 } 749 }
742 750
743 void ShelfLayoutManager::StopAnimating() { 751 void ShelfLayoutManager::StopAnimating() {
744 GetLayer(shelf_)->GetAnimator()->StopAnimating(); 752 GetLayer(shelf_)->GetAnimator()->StopAnimating();
745 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); 753 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating();
746 } 754 }
747 755
748 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { 756 void ShelfLayoutManager::GetShelfSize(int* width, int* height) {
749 *width = *height = 0; 757 *width = *height = 0;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1134
1127 keyboard_bounds_ = new_bounds; 1135 keyboard_bounds_ = new_bounds;
1128 OnWindowResized(); 1136 OnWindowResized();
1129 1137
1130 SessionStateDelegate* session_state_delegate = 1138 SessionStateDelegate* session_state_delegate =
1131 Shell::GetInstance()->session_state_delegate(); 1139 Shell::GetInstance()->session_state_delegate();
1132 1140
1133 // On login screen if keyboard has been just hidden, update bounds just once 1141 // On login screen if keyboard has been just hidden, update bounds just once
1134 // but ignore target_bounds.work_area_insets since shelf overlaps with login 1142 // but ignore target_bounds.work_area_insets since shelf overlaps with login
1135 // window. 1143 // window.
1136 if (!session_state_delegate->IsActiveUserSessionStarted() && 1144 if (session_state_delegate->IsUserSessionBlocked() &&
1137 keyboard_is_about_to_hide) { 1145 keyboard_is_about_to_hide) {
1138 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); 1146 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets());
1139 } 1147 }
1140 } 1148 }
1141 1149
1142 void ShelfLayoutManager::OnDockBoundsChanging( 1150 void ShelfLayoutManager::OnDockBoundsChanging(
1143 const gfx::Rect& dock_bounds, 1151 const gfx::Rect& dock_bounds,
1144 DockedWindowLayoutManagerObserver::Reason reason) { 1152 DockedWindowLayoutManagerObserver::Reason reason) {
1145 // Skip shelf layout in case docked notification originates from this class. 1153 // Skip shelf layout in case docked notification originates from this class.
1146 if (reason == DISPLAY_INSETS_CHANGED) 1154 if (reason == DISPLAY_INSETS_CHANGED)
(...skipping 14 matching lines...) Expand all
1161 // Hide the status area widget (using auto hide animation). 1169 // Hide the status area widget (using auto hide animation).
1162 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state, 1170 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state,
1163 SHELF_HIDDEN); 1171 SHELF_HIDDEN);
1164 TargetBounds target_bounds; 1172 TargetBounds target_bounds;
1165 CalculateTargetBounds(state_, &target_bounds); 1173 CalculateTargetBounds(state_, &target_bounds);
1166 UpdateBoundsAndOpacity(target_bounds, true, NULL); 1174 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1167 UpdateVisibilityState(); 1175 UpdateVisibilityState();
1168 } 1176 }
1169 } 1177 }
1170 1178
1179 void ShelfLayoutManager::SessionStateChanged(
1180 SessionStateDelegate::SessionState state) {
1181 TargetBounds target_bounds;
1182 CalculateTargetBounds(state_, &target_bounds);
1183 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1184 UpdateVisibilityState();
1185 }
1186
1171 } // namespace ash 1187 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/test/test_session_state_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698