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

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: 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 mouse_over_shelf_when_auto_hide_timer_started_(false), 206 mouse_over_shelf_when_auto_hide_timer_started_(false),
207 bezel_event_filter_(new ShelfBezelEventFilter(this)), 207 bezel_event_filter_(new ShelfBezelEventFilter(this)),
208 gesture_drag_status_(GESTURE_DRAG_NONE), 208 gesture_drag_status_(GESTURE_DRAG_NONE),
209 gesture_drag_amount_(0.f), 209 gesture_drag_amount_(0.f),
210 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), 210 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
211 update_shelf_observer_(NULL), 211 update_shelf_observer_(NULL),
212 duration_override_in_ms_(0) { 212 duration_override_in_ms_(0) {
213 Shell::GetInstance()->AddShellObserver(this); 213 Shell::GetInstance()->AddShellObserver(this);
214 Shell::GetInstance()->lock_state_controller()->AddObserver(this); 214 Shell::GetInstance()->lock_state_controller()->AddObserver(this);
215 aura::client::GetActivationClient(root_window_)->AddObserver(this); 215 aura::client::GetActivationClient(root_window_)->AddObserver(this);
216 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
Daniel Erat 2014/04/10 16:30:32 you're missing the call to remove this in the d'to
Nikita (slow) 2014/04/10 17:22:51 Done.
216 } 217 }
217 218
218 ShelfLayoutManager::~ShelfLayoutManager() { 219 ShelfLayoutManager::~ShelfLayoutManager() {
219 if (update_shelf_observer_) 220 if (update_shelf_observer_)
220 update_shelf_observer_->Detach(); 221 update_shelf_observer_->Detach();
221 222
222 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); 223 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf());
223 Shell::GetInstance()->RemoveShellObserver(this); 224 Shell::GetInstance()->RemoveShellObserver(this);
224 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); 225 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this);
225 aura::client::GetActivationClient(root_window_)->RemoveObserver(this); 226 aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 status_bounds.set_x(status_bounds.x() + 734 status_bounds.set_x(status_bounds.x() +
734 target_bounds.shelf_bounds_in_root.x()); 735 target_bounds.shelf_bounds_in_root.x());
735 status_bounds.set_y(status_bounds.y() + 736 status_bounds.set_y(status_bounds.y() +
736 target_bounds.shelf_bounds_in_root.y()); 737 target_bounds.shelf_bounds_in_root.y());
737 shelf_->status_area_widget()->SetBounds( 738 shelf_->status_area_widget()->SetBounds(
738 ScreenUtil::ConvertRectToScreen( 739 ScreenUtil::ConvertRectToScreen(
739 shelf_->status_area_widget()->GetNativeView()->parent(), 740 shelf_->status_area_widget()->GetNativeView()->parent(),
740 status_bounds)); 741 status_bounds));
741 SessionStateDelegate* session_state_delegate = 742 SessionStateDelegate* session_state_delegate =
742 Shell::GetInstance()->session_state_delegate(); 743 Shell::GetInstance()->session_state_delegate();
743 if (!state_.is_screen_locked && 744 if (!state_.is_screen_locked) {
744 (session_state_delegate->IsActiveUserSessionStarted() || 745 gfx::Insets insets;
745 !keyboard_bounds_.IsEmpty())) { 746 // If user session is blocked (login to new user session or add user to
746 Shell::GetInstance()->SetDisplayWorkAreaInsets( 747 // the existing session - multi-profile) then give 100% of work area only if
747 root_window_, target_bounds.work_area_insets); 748 // keyboard is not shown.
749 if (!session_state_delegate->IsUserSessionBlocked() ||
750 !keyboard_bounds_.IsEmpty()) {
751 insets = target_bounds.work_area_insets;
752 }
753 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, insets);
748 } 754 }
749 } 755 }
750 756
751 void ShelfLayoutManager::StopAnimating() { 757 void ShelfLayoutManager::StopAnimating() {
752 GetLayer(shelf_)->GetAnimator()->StopAnimating(); 758 GetLayer(shelf_)->GetAnimator()->StopAnimating();
753 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); 759 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating();
754 } 760 }
755 761
756 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { 762 void ShelfLayoutManager::GetShelfSize(int* width, int* height) {
757 *width = *height = 0; 763 *width = *height = 0;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1164
1159 keyboard_bounds_ = new_bounds; 1165 keyboard_bounds_ = new_bounds;
1160 OnWindowResized(); 1166 OnWindowResized();
1161 1167
1162 SessionStateDelegate* session_state_delegate = 1168 SessionStateDelegate* session_state_delegate =
1163 Shell::GetInstance()->session_state_delegate(); 1169 Shell::GetInstance()->session_state_delegate();
1164 1170
1165 // On login screen if keyboard has been just hidden, update bounds just once 1171 // On login screen if keyboard has been just hidden, update bounds just once
1166 // but ignore target_bounds.work_area_insets since shelf overlaps with login 1172 // but ignore target_bounds.work_area_insets since shelf overlaps with login
1167 // window. 1173 // window.
1168 if (!session_state_delegate->IsActiveUserSessionStarted() && 1174 if (session_state_delegate->IsUserSessionBlocked() &&
1169 keyboard_is_about_to_hide) { 1175 keyboard_is_about_to_hide) {
1170 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); 1176 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets());
1171 } 1177 }
1172 } 1178 }
1173 1179
1174 void ShelfLayoutManager::OnDockBoundsChanging( 1180 void ShelfLayoutManager::OnDockBoundsChanging(
1175 const gfx::Rect& dock_bounds, 1181 const gfx::Rect& dock_bounds,
1176 DockedWindowLayoutManagerObserver::Reason reason) { 1182 DockedWindowLayoutManagerObserver::Reason reason) {
1177 // Skip shelf layout in case docked notification originates from this class. 1183 // Skip shelf layout in case docked notification originates from this class.
1178 if (reason == DISPLAY_INSETS_CHANGED) 1184 if (reason == DISPLAY_INSETS_CHANGED)
(...skipping 14 matching lines...) Expand all
1193 // Hide the status area widget (using auto hide animation). 1199 // Hide the status area widget (using auto hide animation).
1194 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state, 1200 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state,
1195 SHELF_HIDDEN); 1201 SHELF_HIDDEN);
1196 TargetBounds target_bounds; 1202 TargetBounds target_bounds;
1197 CalculateTargetBounds(state_, &target_bounds); 1203 CalculateTargetBounds(state_, &target_bounds);
1198 UpdateBoundsAndOpacity(target_bounds, true, NULL); 1204 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1199 UpdateVisibilityState(); 1205 UpdateVisibilityState();
1200 } 1206 }
1201 } 1207 }
1202 1208
1209 void ShelfLayoutManager::SessionStateChanged(
1210 SessionStateDelegate::SessionState state) {
1211 TargetBounds target_bounds;
1212 CalculateTargetBounds(state_, &target_bounds);
1213 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1214 UpdateVisibilityState();
1215 }
1216
1203 } // namespace ash 1217 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698