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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 ShelfAutoHideState auto_hide_state = | 364 ShelfAutoHideState auto_hide_state = |
365 CalculateAutoHideState(state_.visibility_state); | 365 CalculateAutoHideState(state_.visibility_state); |
366 if (auto_hide_state != state_.auto_hide_state) { | 366 if (auto_hide_state != state_.auto_hide_state) { |
367 if (auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { | 367 if (auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { |
368 // Hides happen immediately. | 368 // Hides happen immediately. |
369 SetState(state_.visibility_state); | 369 SetState(state_.visibility_state); |
370 } else { | 370 } else { |
371 if (!auto_hide_timer_.IsRunning()) { | 371 if (!auto_hide_timer_.IsRunning()) { |
372 mouse_over_shelf_when_auto_hide_timer_started_ = | 372 mouse_over_shelf_when_auto_hide_timer_started_ = |
373 shelf_->GetWindowBoundsInScreen().Contains( | 373 shelf_->GetWindowBoundsInScreen().Contains( |
374 Shell::GetScreen()->GetCursorScreenPoint()); | 374 gfx::Screen::GetScreen()->GetCursorScreenPoint()); |
375 } | 375 } |
376 auto_hide_timer_.Start( | 376 auto_hide_timer_.Start( |
377 FROM_HERE, | 377 FROM_HERE, |
378 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), | 378 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), |
379 this, &ShelfLayoutManager::UpdateAutoHideStateNow); | 379 this, &ShelfLayoutManager::UpdateAutoHideStateNow); |
380 } | 380 } |
381 } else { | 381 } else { |
382 StopAutoHideTimer(); | 382 StopAutoHideTimer(); |
383 } | 383 } |
384 } | 384 } |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 -kNotificationBubbleGapHeight : 0, | 1078 -kNotificationBubbleGapHeight : 0, |
1079 alignment == SHELF_ALIGNMENT_BOTTOM ? | 1079 alignment == SHELF_ALIGNMENT_BOTTOM ? |
1080 -kNotificationBubbleGapHeight : 0, | 1080 -kNotificationBubbleGapHeight : 0, |
1081 alignment == SHELF_ALIGNMENT_LEFT ? | 1081 alignment == SHELF_ALIGNMENT_LEFT ? |
1082 -kNotificationBubbleGapHeight : 0, | 1082 -kNotificationBubbleGapHeight : 0, |
1083 alignment == SHELF_ALIGNMENT_TOP ? | 1083 alignment == SHELF_ALIGNMENT_TOP ? |
1084 -kNotificationBubbleGapHeight : 0); | 1084 -kNotificationBubbleGapHeight : 0); |
1085 } | 1085 } |
1086 | 1086 |
1087 gfx::Point cursor_position_in_screen = | 1087 gfx::Point cursor_position_in_screen = |
1088 Shell::GetScreen()->GetCursorScreenPoint(); | 1088 gfx::Screen::GetScreen()->GetCursorScreenPoint(); |
1089 if (shelf_region.Contains(cursor_position_in_screen)) | 1089 if (shelf_region.Contains(cursor_position_in_screen)) |
1090 return SHELF_AUTO_HIDE_SHOWN; | 1090 return SHELF_AUTO_HIDE_SHOWN; |
1091 | 1091 |
1092 // When the shelf is auto hidden and the shelf is on the boundary between two | 1092 // When the shelf is auto hidden and the shelf is on the boundary between two |
1093 // displays, it is hard to trigger showing the shelf. For instance, if a | 1093 // displays, it is hard to trigger showing the shelf. For instance, if a |
1094 // user's primary display is left of their secondary display, it is hard to | 1094 // user's primary display is left of their secondary display, it is hard to |
1095 // unautohide a left aligned shelf on the secondary display. | 1095 // unautohide a left aligned shelf on the secondary display. |
1096 // It is hard because: | 1096 // It is hard because: |
1097 // - It is hard to stop the cursor in the shelf "light bar" and not overshoot. | 1097 // - It is hard to stop the cursor in the shelf "light bar" and not overshoot. |
1098 // - The cursor is warped to the other display if the cursor gets to the edge | 1098 // - The cursor is warped to the other display if the cursor gets to the edge |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 return false; | 1205 return false; |
1206 } | 1206 } |
1207 if (session_state_delegate->IsUserSessionBlocked() || | 1207 if (session_state_delegate->IsUserSessionBlocked() || |
1208 state_.is_adding_user_screen) { | 1208 state_.is_adding_user_screen) { |
1209 return true; | 1209 return true; |
1210 } | 1210 } |
1211 return false; | 1211 return false; |
1212 } | 1212 } |
1213 | 1213 |
1214 } // namespace ash | 1214 } // namespace ash |
OLD | NEW |