| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (IsAlignmentLocked()) | 269 if (IsAlignmentLocked()) |
| 270 return SHELF_ALIGNMENT_BOTTOM; | 270 return SHELF_ALIGNMENT_BOTTOM; |
| 271 return alignment_; | 271 return alignment_; |
| 272 } | 272 } |
| 273 | 273 |
| 274 gfx::Rect ShelfLayoutManager::GetIdealBounds() { | 274 gfx::Rect ShelfLayoutManager::GetIdealBounds() { |
| 275 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); | 275 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); |
| 276 return SelectValueForShelfAlignment( | 276 return SelectValueForShelfAlignment( |
| 277 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize), | 277 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize), |
| 278 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()), | 278 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()), |
| 279 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize, rect.height()), | 279 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize, |
| 280 gfx::Rect(rect.x(), rect.y(), rect.width(), kShelfSize)); | 280 rect.height())); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ShelfLayoutManager::LayoutShelf() { | 283 void ShelfLayoutManager::LayoutShelf() { |
| 284 TargetBounds target_bounds; | 284 TargetBounds target_bounds; |
| 285 CalculateTargetBounds(state_, &target_bounds); | 285 CalculateTargetBounds(state_, &target_bounds); |
| 286 UpdateBoundsAndOpacity(target_bounds, false, NULL); | 286 UpdateBoundsAndOpacity(target_bounds, false, NULL); |
| 287 | 287 |
| 288 if (shelf_->shelf()) { | 288 if (shelf_->shelf()) { |
| 289 // Update insets in ShelfWindowTargeter when shelf bounds change. | 289 // Update insets in ShelfWindowTargeter when shelf bounds change. |
| 290 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 290 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) { | 421 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) { |
| 422 should_change = drag_ratio > kDragHideThreshold; | 422 should_change = drag_ratio > kDragHideThreshold; |
| 423 } else { | 423 } else { |
| 424 bool correct_direction = false; | 424 bool correct_direction = false; |
| 425 switch (GetAlignment()) { | 425 switch (GetAlignment()) { |
| 426 case SHELF_ALIGNMENT_BOTTOM: | 426 case SHELF_ALIGNMENT_BOTTOM: |
| 427 case SHELF_ALIGNMENT_RIGHT: | 427 case SHELF_ALIGNMENT_RIGHT: |
| 428 correct_direction = gesture_drag_amount_ < 0; | 428 correct_direction = gesture_drag_amount_ < 0; |
| 429 break; | 429 break; |
| 430 case SHELF_ALIGNMENT_LEFT: | 430 case SHELF_ALIGNMENT_LEFT: |
| 431 case SHELF_ALIGNMENT_TOP: | |
| 432 correct_direction = gesture_drag_amount_ > 0; | 431 correct_direction = gesture_drag_amount_ > 0; |
| 433 break; | 432 break; |
| 434 } | 433 } |
| 435 should_change = correct_direction && drag_ratio > kDragHideThreshold; | 434 should_change = correct_direction && drag_ratio > kDragHideThreshold; |
| 436 } | 435 } |
| 437 } else if (gesture.type() == ui::ET_SCROLL_FLING_START) { | 436 } else if (gesture.type() == ui::ET_SCROLL_FLING_START) { |
| 438 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) { | 437 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) { |
| 439 should_change = horizontal ? fabs(gesture.details().velocity_y()) > 0 : | 438 should_change = horizontal ? fabs(gesture.details().velocity_y()) > 0 : |
| 440 fabs(gesture.details().velocity_x()) > 0; | 439 fabs(gesture.details().velocity_x()) > 0; |
| 441 } else { | 440 } else { |
| 442 should_change = SelectValueForShelfAlignment( | 441 should_change = |
| 443 gesture.details().velocity_y() < 0, | 442 SelectValueForShelfAlignment(gesture.details().velocity_y() < 0, |
| 444 gesture.details().velocity_x() > 0, | 443 gesture.details().velocity_x() > 0, |
| 445 gesture.details().velocity_x() < 0, | 444 gesture.details().velocity_x() < 0); |
| 446 gesture.details().velocity_y() > 0); | |
| 447 } | 445 } |
| 448 } else { | 446 } else { |
| 449 NOTREACHED(); | 447 NOTREACHED(); |
| 450 } | 448 } |
| 451 | 449 |
| 452 if (!should_change) { | 450 if (!should_change) { |
| 453 CancelGestureDrag(); | 451 CancelGestureDrag(); |
| 454 return; | 452 return; |
| 455 } | 453 } |
| 456 if (shelf_) { | 454 if (shelf_) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 512 } |
| 515 | 513 |
| 516 void ShelfLayoutManager::OnWindowActivated( | 514 void ShelfLayoutManager::OnWindowActivated( |
| 517 aura::client::ActivationChangeObserver::ActivationReason reason, | 515 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 518 aura::Window* gained_active, | 516 aura::Window* gained_active, |
| 519 aura::Window* lost_active) { | 517 aura::Window* lost_active) { |
| 520 UpdateAutoHideStateNow(); | 518 UpdateAutoHideStateNow(); |
| 521 } | 519 } |
| 522 | 520 |
| 523 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 521 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
| 524 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || | 522 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM; |
| 525 GetAlignment() == SHELF_ALIGNMENT_TOP; | |
| 526 } | 523 } |
| 527 | 524 |
| 528 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { | 525 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
| 529 chromevox_panel_height_ = height; | 526 chromevox_panel_height_ = height; |
| 530 LayoutShelf(); | 527 LayoutShelf(); |
| 531 } | 528 } |
| 532 | 529 |
| 533 //////////////////////////////////////////////////////////////////////////////// | 530 //////////////////////////////////////////////////////////////////////////////// |
| 534 // ShelfLayoutManager, private: | 531 // ShelfLayoutManager, private: |
| 535 | 532 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 int shelf_height = PrimaryAxisValue(shelf_size, available_bounds.height()); | 736 int shelf_height = PrimaryAxisValue(shelf_size, available_bounds.height()); |
| 740 int bottom_shelf_vertical_offset = available_bounds.bottom(); | 737 int bottom_shelf_vertical_offset = available_bounds.bottom(); |
| 741 if (keyboard_bounds_.IsEmpty()) | 738 if (keyboard_bounds_.IsEmpty()) |
| 742 bottom_shelf_vertical_offset -= shelf_height; | 739 bottom_shelf_vertical_offset -= shelf_height; |
| 743 else | 740 else |
| 744 bottom_shelf_vertical_offset -= keyboard_bounds_.height(); | 741 bottom_shelf_vertical_offset -= keyboard_bounds_.height(); |
| 745 | 742 |
| 746 gfx::Point shelf_origin = SelectValueForShelfAlignment( | 743 gfx::Point shelf_origin = SelectValueForShelfAlignment( |
| 747 gfx::Point(available_bounds.x(), bottom_shelf_vertical_offset), | 744 gfx::Point(available_bounds.x(), bottom_shelf_vertical_offset), |
| 748 gfx::Point(available_bounds.x(), available_bounds.y()), | 745 gfx::Point(available_bounds.x(), available_bounds.y()), |
| 749 gfx::Point(available_bounds.right() - shelf_width, available_bounds.y()), | 746 gfx::Point(available_bounds.right() - shelf_width, available_bounds.y())); |
| 750 gfx::Point(available_bounds.x(), available_bounds.y())); | |
| 751 target_bounds->shelf_bounds_in_root = | 747 target_bounds->shelf_bounds_in_root = |
| 752 gfx::Rect(shelf_origin.x(), shelf_origin.y(), shelf_width, shelf_height); | 748 gfx::Rect(shelf_origin.x(), shelf_origin.y(), shelf_width, shelf_height); |
| 753 | 749 |
| 754 gfx::Size status_size( | 750 gfx::Size status_size( |
| 755 shelf_->status_area_widget()->GetWindowBoundsInScreen().size()); | 751 shelf_->status_area_widget()->GetWindowBoundsInScreen().size()); |
| 756 if (IsHorizontalAlignment()) | 752 if (IsHorizontalAlignment()) |
| 757 status_size.set_height(kShelfSize); | 753 status_size.set_height(kShelfSize); |
| 758 else | 754 else |
| 759 status_size.set_width(kShelfSize); | 755 status_size.set_width(kShelfSize); |
| 760 | 756 |
| 761 gfx::Point status_origin = SelectValueForShelfAlignment( | 757 gfx::Point status_origin = SelectValueForShelfAlignment( |
| 762 gfx::Point(0, 0), | 758 gfx::Point(0, 0), |
| 763 gfx::Point(shelf_width - status_size.width(), | 759 gfx::Point(shelf_width - status_size.width(), |
| 764 shelf_height - status_size.height()), | 760 shelf_height - status_size.height()), |
| 765 gfx::Point(0, shelf_height - status_size.height()), | |
| 766 gfx::Point(0, shelf_height - status_size.height())); | 761 gfx::Point(0, shelf_height - status_size.height())); |
| 767 if (IsHorizontalAlignment() && !base::i18n::IsRTL()) | 762 if (IsHorizontalAlignment() && !base::i18n::IsRTL()) |
| 768 status_origin.set_x(shelf_width - status_size.width()); | 763 status_origin.set_x(shelf_width - status_size.width()); |
| 769 target_bounds->status_bounds_in_shelf = gfx::Rect(status_origin, status_size); | 764 target_bounds->status_bounds_in_shelf = gfx::Rect(status_origin, status_size); |
| 770 | 765 |
| 771 target_bounds->work_area_insets = SelectValueForShelfAlignment( | 766 target_bounds->work_area_insets = SelectValueForShelfAlignment( |
| 772 gfx::Insets(0, 0, GetWorkAreaSize(state, shelf_height), 0), | 767 gfx::Insets(0, 0, GetWorkAreaSize(state, shelf_height), 0), |
| 773 gfx::Insets(0, GetWorkAreaSize(state, shelf_width), 0, 0), | 768 gfx::Insets(0, GetWorkAreaSize(state, shelf_width), 0, 0), |
| 774 gfx::Insets(0, 0, 0, GetWorkAreaSize(state, shelf_width)), | 769 gfx::Insets(0, 0, 0, GetWorkAreaSize(state, shelf_width))); |
| 775 gfx::Insets(GetWorkAreaSize(state, shelf_height), 0, 0, 0)); | |
| 776 | 770 |
| 777 // TODO(varkha): The functionality of managing insets for display areas | 771 // TODO(varkha): The functionality of managing insets for display areas |
| 778 // should probably be pushed to a separate component. This would simplify or | 772 // should probably be pushed to a separate component. This would simplify or |
| 779 // remove entirely the dependency on keyboard and dock. | 773 // remove entirely the dependency on keyboard and dock. |
| 780 | 774 |
| 781 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { | 775 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { |
| 782 // Also push in the work area inset for the keyboard if it is visible. | 776 // Also push in the work area inset for the keyboard if it is visible. |
| 783 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); | 777 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); |
| 784 target_bounds->work_area_insets += keyboard_insets; | 778 target_bounds->work_area_insets += keyboard_insets; |
| 785 } | 779 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 807 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | 801 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
| 808 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? | 802 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? |
| 809 0.0f : target_bounds->opacity; | 803 0.0f : target_bounds->opacity; |
| 810 | 804 |
| 811 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) | 805 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS) |
| 812 UpdateTargetBoundsForGesture(target_bounds); | 806 UpdateTargetBoundsForGesture(target_bounds); |
| 813 | 807 |
| 814 // This needs to happen after calling UpdateTargetBoundsForGesture(), because | 808 // This needs to happen after calling UpdateTargetBoundsForGesture(), because |
| 815 // that can change the size of the shelf. | 809 // that can change the size of the shelf. |
| 816 target_bounds->shelf_bounds_in_shelf = SelectValueForShelfAlignment( | 810 target_bounds->shelf_bounds_in_shelf = SelectValueForShelfAlignment( |
| 817 gfx::Rect(0, 0, | 811 gfx::Rect(0, 0, shelf_width - status_size.width(), |
| 818 shelf_width - status_size.width(), | |
| 819 target_bounds->shelf_bounds_in_root.height()), | 812 target_bounds->shelf_bounds_in_root.height()), |
| 820 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), | 813 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), |
| 821 shelf_height - status_size.height()), | 814 shelf_height - status_size.height()), |
| 822 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), | 815 gfx::Rect(0, 0, target_bounds->shelf_bounds_in_root.width(), |
| 823 shelf_height - status_size.height()), | 816 shelf_height - status_size.height())); |
| 824 gfx::Rect(0, 0, | |
| 825 shelf_width - status_size.width(), | |
| 826 target_bounds->shelf_bounds_in_root.height())); | |
| 827 | 817 |
| 828 available_bounds.Subtract(target_bounds->shelf_bounds_in_root); | 818 available_bounds.Subtract(target_bounds->shelf_bounds_in_root); |
| 829 available_bounds.Subtract(keyboard_bounds_); | 819 available_bounds.Subtract(keyboard_bounds_); |
| 830 user_work_area_bounds_ = | 820 user_work_area_bounds_ = |
| 831 ScreenUtil::ConvertRectToScreen(root_window_, available_bounds); | 821 ScreenUtil::ConvertRectToScreen(root_window_, available_bounds); |
| 832 } | 822 } |
| 833 | 823 |
| 834 void ShelfLayoutManager::UpdateTargetBoundsForGesture( | 824 void ShelfLayoutManager::UpdateTargetBoundsForGesture( |
| 835 TargetBounds* target_bounds) const { | 825 TargetBounds* target_bounds) const { |
| 836 CHECK_EQ(GESTURE_DRAG_IN_PROGRESS, gesture_drag_status_); | 826 CHECK_EQ(GESTURE_DRAG_IN_PROGRESS, gesture_drag_status_); |
| 837 bool horizontal = IsHorizontalAlignment(); | 827 bool horizontal = IsHorizontalAlignment(); |
| 838 gfx::Rect available_bounds = | 828 gfx::Rect available_bounds = |
| 839 ScreenUtil::GetShelfDisplayBoundsInRoot(root_window_); | 829 ScreenUtil::GetShelfDisplayBoundsInRoot(root_window_); |
| 840 int resistance_free_region = 0; | 830 int resistance_free_region = 0; |
| 841 | 831 |
| 842 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && | 832 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && |
| 843 visibility_state() == SHELF_AUTO_HIDE && | 833 visibility_state() == SHELF_AUTO_HIDE && |
| 844 auto_hide_state() != SHELF_AUTO_HIDE_SHOWN) { | 834 auto_hide_state() != SHELF_AUTO_HIDE_SHOWN) { |
| 845 // If the shelf was hidden when the drag started (and the state hasn't | 835 // If the shelf was hidden when the drag started (and the state hasn't |
| 846 // changed since then, e.g. because the tray-menu was shown because of the | 836 // changed since then, e.g. because the tray-menu was shown because of the |
| 847 // drag), then allow the drag some resistance-free region at first to make | 837 // drag), then allow the drag some resistance-free region at first to make |
| 848 // sure the shelf sticks with the finger until the shelf is visible. | 838 // sure the shelf sticks with the finger until the shelf is visible. |
| 849 resistance_free_region = kShelfSize - kAutoHideSize; | 839 resistance_free_region = kShelfSize - kAutoHideSize; |
| 850 } | 840 } |
| 851 | 841 |
| 852 bool resist = SelectValueForShelfAlignment( | 842 bool resist = SelectValueForShelfAlignment( |
| 853 gesture_drag_amount_ < -resistance_free_region, | 843 gesture_drag_amount_ < -resistance_free_region, |
| 854 gesture_drag_amount_ > resistance_free_region, | 844 gesture_drag_amount_ > resistance_free_region, |
| 855 gesture_drag_amount_ < -resistance_free_region, | 845 gesture_drag_amount_ < -resistance_free_region); |
| 856 gesture_drag_amount_ > resistance_free_region); | |
| 857 | 846 |
| 858 float translate = 0.f; | 847 float translate = 0.f; |
| 859 if (resist) { | 848 if (resist) { |
| 860 float diff = fabsf(gesture_drag_amount_) - resistance_free_region; | 849 float diff = fabsf(gesture_drag_amount_) - resistance_free_region; |
| 861 diff = std::min(diff, sqrtf(diff)); | 850 diff = std::min(diff, sqrtf(diff)); |
| 862 if (gesture_drag_amount_ < 0) | 851 if (gesture_drag_amount_ < 0) |
| 863 translate = -resistance_free_region - diff; | 852 translate = -resistance_free_region - diff; |
| 864 else | 853 else |
| 865 translate = resistance_free_region + diff; | 854 translate = resistance_free_region + diff; |
| 866 } else { | 855 } else { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 void ShelfLayoutManager::StopAutoHideTimer() { | 925 void ShelfLayoutManager::StopAutoHideTimer() { |
| 937 auto_hide_timer_.Stop(); | 926 auto_hide_timer_.Stop(); |
| 938 mouse_over_shelf_when_auto_hide_timer_started_ = false; | 927 mouse_over_shelf_when_auto_hide_timer_started_ = false; |
| 939 } | 928 } |
| 940 | 929 |
| 941 gfx::Rect ShelfLayoutManager::GetAutoHideShowShelfRegionInScreen() const { | 930 gfx::Rect ShelfLayoutManager::GetAutoHideShowShelfRegionInScreen() const { |
| 942 gfx::Rect shelf_bounds_in_screen = shelf_->GetWindowBoundsInScreen(); | 931 gfx::Rect shelf_bounds_in_screen = shelf_->GetWindowBoundsInScreen(); |
| 943 gfx::Vector2d offset = SelectValueForShelfAlignment( | 932 gfx::Vector2d offset = SelectValueForShelfAlignment( |
| 944 gfx::Vector2d(0, shelf_bounds_in_screen.height()), | 933 gfx::Vector2d(0, shelf_bounds_in_screen.height()), |
| 945 gfx::Vector2d(-kMaxAutoHideShowShelfRegionSize, 0), | 934 gfx::Vector2d(-kMaxAutoHideShowShelfRegionSize, 0), |
| 946 gfx::Vector2d(shelf_bounds_in_screen.width(), 0), | 935 gfx::Vector2d(shelf_bounds_in_screen.width(), 0)); |
| 947 gfx::Vector2d(0, -kMaxAutoHideShowShelfRegionSize)); | |
| 948 | 936 |
| 949 gfx::Rect show_shelf_region_in_screen = shelf_bounds_in_screen; | 937 gfx::Rect show_shelf_region_in_screen = shelf_bounds_in_screen; |
| 950 show_shelf_region_in_screen += offset; | 938 show_shelf_region_in_screen += offset; |
| 951 if (IsHorizontalAlignment()) | 939 if (IsHorizontalAlignment()) |
| 952 show_shelf_region_in_screen.set_height(kMaxAutoHideShowShelfRegionSize); | 940 show_shelf_region_in_screen.set_height(kMaxAutoHideShowShelfRegionSize); |
| 953 else | 941 else |
| 954 show_shelf_region_in_screen.set_width(kMaxAutoHideShowShelfRegionSize); | 942 show_shelf_region_in_screen.set_width(kMaxAutoHideShowShelfRegionSize); |
| 955 | 943 |
| 956 // TODO: Figure out if we need any special handling when the keyboard is | 944 // TODO: Figure out if we need any special handling when the keyboard is |
| 957 // visible. | 945 // visible. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 if (!cursor_client->IsMouseEventsEnabled()) | 1008 if (!cursor_client->IsMouseEventsEnabled()) |
| 1021 return SHELF_AUTO_HIDE_HIDDEN; | 1009 return SHELF_AUTO_HIDE_HIDDEN; |
| 1022 | 1010 |
| 1023 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); | 1011 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); |
| 1024 if (shelf_->status_area_widget() && | 1012 if (shelf_->status_area_widget() && |
| 1025 shelf_->status_area_widget()->IsMessageBubbleShown() && | 1013 shelf_->status_area_widget()->IsMessageBubbleShown() && |
| 1026 IsVisible()) { | 1014 IsVisible()) { |
| 1027 // Increase the the hit test area to prevent the shelf from disappearing | 1015 // Increase the the hit test area to prevent the shelf from disappearing |
| 1028 // when the mouse is over the bubble gap. | 1016 // when the mouse is over the bubble gap. |
| 1029 ShelfAlignment alignment = GetAlignment(); | 1017 ShelfAlignment alignment = GetAlignment(); |
| 1030 shelf_region.Inset(alignment == SHELF_ALIGNMENT_RIGHT ? | 1018 shelf_region.Inset( |
| 1031 -kNotificationBubbleGapHeight : 0, | 1019 alignment == SHELF_ALIGNMENT_RIGHT ? -kNotificationBubbleGapHeight : 0, |
| 1032 alignment == SHELF_ALIGNMENT_BOTTOM ? | 1020 alignment == SHELF_ALIGNMENT_BOTTOM ? -kNotificationBubbleGapHeight : 0, |
| 1033 -kNotificationBubbleGapHeight : 0, | 1021 alignment == SHELF_ALIGNMENT_LEFT ? -kNotificationBubbleGapHeight : 0, |
| 1034 alignment == SHELF_ALIGNMENT_LEFT ? | 1022 0); |
| 1035 -kNotificationBubbleGapHeight : 0, | |
| 1036 alignment == SHELF_ALIGNMENT_TOP ? | |
| 1037 -kNotificationBubbleGapHeight : 0); | |
| 1038 } | 1023 } |
| 1039 | 1024 |
| 1040 gfx::Point cursor_position_in_screen = | 1025 gfx::Point cursor_position_in_screen = |
| 1041 gfx::Screen::GetScreen()->GetCursorScreenPoint(); | 1026 gfx::Screen::GetScreen()->GetCursorScreenPoint(); |
| 1042 if (shelf_region.Contains(cursor_position_in_screen)) | 1027 if (shelf_region.Contains(cursor_position_in_screen)) |
| 1043 return SHELF_AUTO_HIDE_SHOWN; | 1028 return SHELF_AUTO_HIDE_SHOWN; |
| 1044 | 1029 |
| 1045 // When the shelf is auto hidden and the shelf is on the boundary between two | 1030 // When the shelf is auto hidden and the shelf is on the boundary between two |
| 1046 // displays, it is hard to trigger showing the shelf. For instance, if a | 1031 // displays, it is hard to trigger showing the shelf. For instance, if a |
| 1047 // user's primary display is left of their secondary display, it is hard to | 1032 // user's primary display is left of their secondary display, it is hard to |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 return false; | 1145 return false; |
| 1161 } | 1146 } |
| 1162 if (session_state_delegate->IsUserSessionBlocked() || | 1147 if (session_state_delegate->IsUserSessionBlocked() || |
| 1163 state_.is_adding_user_screen) { | 1148 state_.is_adding_user_screen) { |
| 1164 return true; | 1149 return true; |
| 1165 } | 1150 } |
| 1166 return false; | 1151 return false; |
| 1167 } | 1152 } |
| 1168 | 1153 |
| 1169 } // namespace ash | 1154 } // namespace ash |
| OLD | NEW |