OLD | NEW |
---|---|
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 Loading... | |
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); | |
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 Loading... | |
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; |
Mr4D (OOO till 08-26)
2014/04/10 01:33:08
By creating the insets they should be initialized
Nikita (slow)
2014/04/10 09:52:21
Done.
| |
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 if (keyboard_bounds_.IsEmpty()) | |
751 insets = gfx::Insets(); | |
752 else | |
753 insets = target_bounds.work_area_insets; | |
754 } else { | |
755 insets = target_bounds.work_area_insets; | |
756 } | |
757 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, insets); | |
748 } | 758 } |
749 } | 759 } |
750 | 760 |
751 void ShelfLayoutManager::StopAnimating() { | 761 void ShelfLayoutManager::StopAnimating() { |
752 GetLayer(shelf_)->GetAnimator()->StopAnimating(); | 762 GetLayer(shelf_)->GetAnimator()->StopAnimating(); |
753 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); | 763 GetLayer(shelf_->status_area_widget())->GetAnimator()->StopAnimating(); |
754 } | 764 } |
755 | 765 |
756 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { | 766 void ShelfLayoutManager::GetShelfSize(int* width, int* height) { |
757 *width = *height = 0; | 767 *width = *height = 0; |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 | 1168 |
1159 keyboard_bounds_ = new_bounds; | 1169 keyboard_bounds_ = new_bounds; |
1160 OnWindowResized(); | 1170 OnWindowResized(); |
1161 | 1171 |
1162 SessionStateDelegate* session_state_delegate = | 1172 SessionStateDelegate* session_state_delegate = |
1163 Shell::GetInstance()->session_state_delegate(); | 1173 Shell::GetInstance()->session_state_delegate(); |
1164 | 1174 |
1165 // On login screen if keyboard has been just hidden, update bounds just once | 1175 // 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 | 1176 // but ignore target_bounds.work_area_insets since shelf overlaps with login |
1167 // window. | 1177 // window. |
1168 if (!session_state_delegate->IsActiveUserSessionStarted() && | 1178 if (session_state_delegate->IsUserSessionBlocked() && |
1169 keyboard_is_about_to_hide) { | 1179 keyboard_is_about_to_hide) { |
1170 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); | 1180 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); |
1171 } | 1181 } |
1172 } | 1182 } |
1173 | 1183 |
1174 void ShelfLayoutManager::OnDockBoundsChanging( | 1184 void ShelfLayoutManager::OnDockBoundsChanging( |
1175 const gfx::Rect& dock_bounds, | 1185 const gfx::Rect& dock_bounds, |
1176 DockedWindowLayoutManagerObserver::Reason reason) { | 1186 DockedWindowLayoutManagerObserver::Reason reason) { |
1177 // Skip shelf layout in case docked notification originates from this class. | 1187 // Skip shelf layout in case docked notification originates from this class. |
1178 if (reason == DISPLAY_INSETS_CHANGED) | 1188 if (reason == DISPLAY_INSETS_CHANGED) |
(...skipping 14 matching lines...) Expand all Loading... | |
1193 // Hide the status area widget (using auto hide animation). | 1203 // Hide the status area widget (using auto hide animation). |
1194 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state, | 1204 base::AutoReset<ShelfVisibilityState> state(&state_.visibility_state, |
1195 SHELF_HIDDEN); | 1205 SHELF_HIDDEN); |
1196 TargetBounds target_bounds; | 1206 TargetBounds target_bounds; |
1197 CalculateTargetBounds(state_, &target_bounds); | 1207 CalculateTargetBounds(state_, &target_bounds); |
1198 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1208 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
1199 UpdateVisibilityState(); | 1209 UpdateVisibilityState(); |
1200 } | 1210 } |
1201 } | 1211 } |
1202 | 1212 |
1213 void ShelfLayoutManager::SessionStateChanged( | |
1214 SessionStateDelegate::SessionState state) { | |
1215 TargetBounds target_bounds; | |
1216 CalculateTargetBounds(state_, &target_bounds); | |
1217 UpdateBoundsAndOpacity(target_bounds, true, NULL); | |
1218 UpdateVisibilityState(); | |
1219 } | |
1220 | |
1203 } // namespace ash | 1221 } // namespace ash |
OLD | NEW |