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/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/launcher/app_list_button.h" | 9 #include "ash/launcher/app_list_button.h" |
10 #include "ash/launcher/launcher_button.h" | 10 #include "ash/launcher/launcher_button.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 745 } |
746 | 746 |
747 bool LauncherView::ShouldHideTooltip(const gfx::Point& cursor_location) { | 747 bool LauncherView::ShouldHideTooltip(const gfx::Point& cursor_location) { |
748 gfx::Rect active_bounds; | 748 gfx::Rect active_bounds; |
749 | 749 |
750 for (int i = 0; i < child_count(); ++i) { | 750 for (int i = 0; i < child_count(); ++i) { |
751 views::View* child = child_at(i); | 751 views::View* child = child_at(i); |
752 if (child == overflow_button_) | 752 if (child == overflow_button_) |
753 continue; | 753 continue; |
754 | 754 |
| 755 // The tooltip shouldn't show over the app-list window. |
| 756 if (child == GetAppListButtonView() && |
| 757 Shell::GetInstance()->GetAppListWindow()) |
| 758 continue; |
| 759 |
755 gfx::Rect child_bounds = child->GetMirroredBounds(); | 760 gfx::Rect child_bounds = child->GetMirroredBounds(); |
756 active_bounds = active_bounds.Union(child_bounds); | 761 active_bounds = active_bounds.Union(child_bounds); |
757 } | 762 } |
758 | 763 |
759 return !active_bounds.Contains(cursor_location); | 764 return !active_bounds.Contains(cursor_location); |
760 } | 765 } |
761 | 766 |
762 int LauncherView::CancelDrag(int modified_index) { | 767 int LauncherView::CancelDrag(int modified_index) { |
763 if (!drag_view_) | 768 if (!drag_view_) |
764 return modified_index; | 769 return modified_index; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 if (canceled) { | 952 if (canceled) { |
948 CancelDrag(-1); | 953 CancelDrag(-1); |
949 } else if (drag_pointer_ == pointer) { | 954 } else if (drag_pointer_ == pointer) { |
950 drag_pointer_ = NONE; | 955 drag_pointer_ = NONE; |
951 drag_view_ = NULL; | 956 drag_view_ = NULL; |
952 AnimateToIdealBounds(); | 957 AnimateToIdealBounds(); |
953 } | 958 } |
954 } | 959 } |
955 | 960 |
956 void LauncherView::MouseMovedOverButton(views::View* view) { | 961 void LauncherView::MouseMovedOverButton(views::View* view) { |
| 962 // Mouse cursor moves doesn't make effects on the app-list button if |
| 963 // app-list bubble is already visible. |
| 964 if (view == GetAppListButtonView() && |
| 965 Shell::GetInstance()->GetAppListWindow()) |
| 966 return; |
| 967 |
957 if (!tooltip_->IsVisible()) | 968 if (!tooltip_->IsVisible()) |
958 tooltip_->ResetTimer(); | 969 tooltip_->ResetTimer(); |
959 } | 970 } |
960 | 971 |
961 void LauncherView::MouseEnteredButton(views::View* view) { | 972 void LauncherView::MouseEnteredButton(views::View* view) { |
| 973 // If mouse cursor enters to the app-list button but app-list bubble is |
| 974 // already visible, we should not show the bubble in that case. |
| 975 if (view == GetAppListButtonView() && |
| 976 Shell::GetInstance()->GetAppListWindow()) |
| 977 return; |
| 978 |
962 if (tooltip_->IsVisible()) { | 979 if (tooltip_->IsVisible()) { |
963 tooltip_->Close(); | |
964 tooltip_->ShowImmediately(view, GetAccessibleName(view)); | 980 tooltip_->ShowImmediately(view, GetAccessibleName(view)); |
965 } else { | 981 } else { |
966 tooltip_->ShowDelayed(view, GetAccessibleName(view)); | 982 tooltip_->ShowDelayed(view, GetAccessibleName(view)); |
967 } | 983 } |
968 } | 984 } |
969 | 985 |
970 void LauncherView::MouseExitedButton(views::View* view) { | 986 void LauncherView::MouseExitedButton(views::View* view) { |
971 if (!tooltip_->IsVisible()) | 987 if (!tooltip_->IsVisible()) |
972 tooltip_->StopTimer(); | 988 tooltip_->StopTimer(); |
973 } | 989 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 return; | 1027 return; |
1012 } | 1028 } |
1013 | 1029 |
1014 if (!delegate_) | 1030 if (!delegate_) |
1015 return; | 1031 return; |
1016 int view_index = view_model_->GetIndexOfView(sender); | 1032 int view_index = view_model_->GetIndexOfView(sender); |
1017 // May be -1 while in the process of animating closed. | 1033 // May be -1 while in the process of animating closed. |
1018 if (view_index == -1) | 1034 if (view_index == -1) |
1019 return; | 1035 return; |
1020 | 1036 |
| 1037 tooltip_->Close(); |
1021 switch (model_->items()[view_index].type) { | 1038 switch (model_->items()[view_index].type) { |
1022 case TYPE_TABBED: | 1039 case TYPE_TABBED: |
1023 case TYPE_APP_PANEL: | 1040 case TYPE_APP_PANEL: |
1024 case TYPE_APP_SHORTCUT: | 1041 case TYPE_APP_SHORTCUT: |
1025 case TYPE_PLATFORM_APP: | 1042 case TYPE_PLATFORM_APP: |
1026 delegate_->ItemClicked(model_->items()[view_index], event.flags()); | 1043 delegate_->ItemClicked(model_->items()[view_index], event.flags()); |
1027 break; | 1044 break; |
1028 | 1045 |
1029 case TYPE_APP_LIST: | 1046 case TYPE_APP_LIST: |
1030 Shell::GetInstance()->ToggleAppList(); | 1047 Shell::GetInstance()->ToggleAppList(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, | 1094 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, |
1078 OnLauncherIconPositionsChanged()); | 1095 OnLauncherIconPositionsChanged()); |
1079 PreferredSizeChanged(); | 1096 PreferredSizeChanged(); |
1080 } | 1097 } |
1081 | 1098 |
1082 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { | 1099 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { |
1083 } | 1100 } |
1084 | 1101 |
1085 } // namespace internal | 1102 } // namespace internal |
1086 } // namespace ash | 1103 } // namespace ash |
OLD | NEW |