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/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 item.is_incognito ? | 679 item.is_incognito ? |
680 TabbedLauncherButton::STATE_INCOGNITO : | 680 TabbedLauncherButton::STATE_INCOGNITO : |
681 TabbedLauncherButton::STATE_NOT_INCOGNITO); | 681 TabbedLauncherButton::STATE_NOT_INCOGNITO); |
682 button->SetTabImage(item.image); | 682 button->SetTabImage(item.image); |
683 ReflectItemStatus(item, button); | 683 ReflectItemStatus(item, button); |
684 view = button; | 684 view = button; |
685 break; | 685 break; |
686 } | 686 } |
687 | 687 |
688 case TYPE_APP_SHORTCUT: | 688 case TYPE_APP_SHORTCUT: |
| 689 case TYPE_WINDOWED_APP: |
689 case TYPE_PLATFORM_APP: | 690 case TYPE_PLATFORM_APP: |
690 case TYPE_APP_PANEL: { | 691 case TYPE_APP_PANEL: { |
691 LauncherButton* button = LauncherButton::Create( | 692 LauncherButton* button = LauncherButton::Create( |
692 this, this, tooltip_->shelf_layout_manager()); | 693 this, this, tooltip_->shelf_layout_manager()); |
693 button->SetImage(item.image); | 694 button->SetImage(item.image); |
694 ReflectItemStatus(item, button); | 695 ReflectItemStatus(item, button); |
695 view = button; | 696 view = button; |
696 break; | 697 break; |
697 } | 698 } |
698 | 699 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 bounds_animator_->StopAnimatingView(drag_view_); | 818 bounds_animator_->StopAnimatingView(drag_view_); |
818 } | 819 } |
819 | 820 |
820 bool LauncherView::SameDragType(LauncherItemType typea, | 821 bool LauncherView::SameDragType(LauncherItemType typea, |
821 LauncherItemType typeb) const { | 822 LauncherItemType typeb) const { |
822 switch (typea) { | 823 switch (typea) { |
823 case TYPE_TABBED: | 824 case TYPE_TABBED: |
824 case TYPE_PLATFORM_APP: | 825 case TYPE_PLATFORM_APP: |
825 return (typeb == TYPE_TABBED || typeb == TYPE_PLATFORM_APP); | 826 return (typeb == TYPE_TABBED || typeb == TYPE_PLATFORM_APP); |
826 case TYPE_APP_SHORTCUT: | 827 case TYPE_APP_SHORTCUT: |
| 828 case TYPE_WINDOWED_APP: |
827 case TYPE_APP_LIST: | 829 case TYPE_APP_LIST: |
828 case TYPE_APP_PANEL: | 830 case TYPE_APP_PANEL: |
829 case TYPE_BROWSER_SHORTCUT: | 831 case TYPE_BROWSER_SHORTCUT: |
830 return typeb == typea; | 832 return typeb == typea; |
831 } | 833 } |
832 NOTREACHED(); | 834 NOTREACHED(); |
833 return false; | 835 return false; |
834 } | 836 } |
835 | 837 |
836 std::pair<int, int> LauncherView::GetDragRange(int index) { | 838 std::pair<int, int> LauncherView::GetDragRange(int index) { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 button->SchedulePaint(); | 1092 button->SchedulePaint(); |
1091 ReflectItemStatus(item, button); | 1093 ReflectItemStatus(item, button); |
1092 break; | 1094 break; |
1093 } | 1095 } |
1094 case TYPE_BROWSER_SHORTCUT: | 1096 case TYPE_BROWSER_SHORTCUT: |
1095 if (!Shell::IsLauncherPerDisplayEnabled()) | 1097 if (!Shell::IsLauncherPerDisplayEnabled()) |
1096 break; | 1098 break; |
1097 // Fallthrough for the new Launcher since it needs to show the activation | 1099 // Fallthrough for the new Launcher since it needs to show the activation |
1098 // change as well. | 1100 // change as well. |
1099 case TYPE_APP_SHORTCUT: | 1101 case TYPE_APP_SHORTCUT: |
| 1102 case TYPE_WINDOWED_APP: |
1100 case TYPE_PLATFORM_APP: | 1103 case TYPE_PLATFORM_APP: |
1101 case TYPE_APP_PANEL: { | 1104 case TYPE_APP_PANEL: { |
1102 LauncherButton* button = static_cast<LauncherButton*>(view); | 1105 LauncherButton* button = static_cast<LauncherButton*>(view); |
1103 ReflectItemStatus(item, button); | 1106 ReflectItemStatus(item, button); |
1104 // The browser shortcut is currently not a "real" item and as such the | 1107 // The browser shortcut is currently not a "real" item and as such the |
1105 // the image is bogous as well. We therefore keep the image as is for it. | 1108 // the image is bogous as well. We therefore keep the image as is for it. |
1106 if (item.type != TYPE_BROWSER_SHORTCUT) | 1109 if (item.type != TYPE_BROWSER_SHORTCUT) |
1107 button->SetImage(item.image); | 1110 button->SetImage(item.image); |
1108 button->SchedulePaint(); | 1111 button->SchedulePaint(); |
1109 break; | 1112 break; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 string16 LauncherView::GetAccessibleName(const views::View* view) { | 1214 string16 LauncherView::GetAccessibleName(const views::View* view) { |
1212 int view_index = view_model_->GetIndexOfView(view); | 1215 int view_index = view_model_->GetIndexOfView(view); |
1213 // May be -1 while in the process of animating closed. | 1216 // May be -1 while in the process of animating closed. |
1214 if (view_index == -1) | 1217 if (view_index == -1) |
1215 return string16(); | 1218 return string16(); |
1216 | 1219 |
1217 switch (model_->items()[view_index].type) { | 1220 switch (model_->items()[view_index].type) { |
1218 case TYPE_TABBED: | 1221 case TYPE_TABBED: |
1219 case TYPE_APP_PANEL: | 1222 case TYPE_APP_PANEL: |
1220 case TYPE_APP_SHORTCUT: | 1223 case TYPE_APP_SHORTCUT: |
| 1224 case TYPE_WINDOWED_APP: |
1221 case TYPE_PLATFORM_APP: | 1225 case TYPE_PLATFORM_APP: |
1222 return delegate_->GetTitle(model_->items()[view_index]); | 1226 return delegate_->GetTitle(model_->items()[view_index]); |
1223 | 1227 |
1224 case TYPE_APP_LIST: | 1228 case TYPE_APP_LIST: |
1225 return model_->status() == LauncherModel::STATUS_LOADING ? | 1229 return model_->status() == LauncherModel::STATUS_LOADING ? |
1226 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : | 1230 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : |
1227 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); | 1231 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); |
1228 | 1232 |
1229 case TYPE_BROWSER_SHORTCUT: | 1233 case TYPE_BROWSER_SHORTCUT: |
1230 return Shell::GetInstance()->delegate()->GetProductName(); | 1234 return Shell::GetInstance()->delegate()->GetProductName(); |
(...skipping 21 matching lines...) Expand all Loading... |
1252 | 1256 |
1253 { | 1257 { |
1254 // Slow down activation animations if shift key is pressed. | 1258 // Slow down activation animations if shift key is pressed. |
1255 scoped_ptr<ScopedAnimationSetter> slowing_animations; | 1259 scoped_ptr<ScopedAnimationSetter> slowing_animations; |
1256 if (event.IsShiftDown()) | 1260 if (event.IsShiftDown()) |
1257 slowing_animations.reset(new ScopedAnimationSetter()); | 1261 slowing_animations.reset(new ScopedAnimationSetter()); |
1258 | 1262 |
1259 // Collect usage statistics before we decide what to do with the click. | 1263 // Collect usage statistics before we decide what to do with the click. |
1260 switch (model_->items()[view_index].type) { | 1264 switch (model_->items()[view_index].type) { |
1261 case TYPE_APP_SHORTCUT: | 1265 case TYPE_APP_SHORTCUT: |
| 1266 case TYPE_WINDOWED_APP: |
1262 case TYPE_PLATFORM_APP: | 1267 case TYPE_PLATFORM_APP: |
1263 Shell::GetInstance()->delegate()->RecordUserMetricsAction( | 1268 Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
1264 UMA_LAUNCHER_CLICK_ON_APP); | 1269 UMA_LAUNCHER_CLICK_ON_APP); |
1265 // Fallthrough | 1270 // Fallthrough |
1266 case TYPE_TABBED: | 1271 case TYPE_TABBED: |
1267 case TYPE_APP_PANEL: | 1272 case TYPE_APP_PANEL: |
1268 delegate_->ItemClicked(model_->items()[view_index], event); | 1273 delegate_->ItemClicked(model_->items()[view_index], event); |
1269 break; | 1274 break; |
1270 | 1275 |
1271 case TYPE_APP_LIST: | 1276 case TYPE_APP_LIST: |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, | 1386 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, |
1382 OnLauncherIconPositionsChanged()); | 1387 OnLauncherIconPositionsChanged()); |
1383 PreferredSizeChanged(); | 1388 PreferredSizeChanged(); |
1384 } | 1389 } |
1385 | 1390 |
1386 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { | 1391 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { |
1387 } | 1392 } |
1388 | 1393 |
1389 } // namespace internal | 1394 } // namespace internal |
1390 } // namespace ash | 1395 } // namespace ash |
OLD | NEW |