Index: ash/shelf/shelf_view.cc |
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc |
index 21651b462b534122786a2f0d2b17677b2d2805af..06d6dd41ef1ba99601b3436417df550b8acaa3c5 100644 |
--- a/ash/shelf/shelf_view.cc |
+++ b/ash/shelf/shelf_view.cc |
@@ -20,7 +20,6 @@ |
#include "ash/shelf/shelf_constants.h" |
#include "ash/shelf/shelf_delegate.h" |
#include "ash/shelf/shelf_icon_observer.h" |
-#include "ash/shelf/shelf_item_delegate.h" |
#include "ash/shelf/shelf_item_delegate_manager.h" |
#include "ash/shelf/shelf_layout_manager.h" |
#include "ash/shelf/shelf_menu_model.h" |
@@ -309,16 +308,6 @@ void ReflectItemStatus(const ShelfItem& item, ShelfButton* button) { |
} |
} |
-void RecordIconActivatedAction(const ui::Event& event) { |
- if (event.IsMouseEvent()) { |
- Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
- UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE); |
- } else if (event.IsGestureEvent()) { |
- Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
- UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH); |
- } |
-} |
- |
} // namespace |
// AnimationDelegate used when deleting an item. This steadily decreased the |
@@ -1693,7 +1682,7 @@ void ShelfView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
if (sender == overflow_button_) { |
ToggleOverflowBubble(); |
- RecordIconActivatedAction(event); |
+ RecordIconActivatedSource(event); |
return; |
} |
@@ -1752,21 +1741,44 @@ void ShelfView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
break; |
} |
- RecordIconActivatedAction(event); |
+ RecordIconActivatedSource(event); |
- switch (item_manager_->GetShelfItemDelegate(model_->items()[view_index].id) |
- ->ItemSelected(event)) { |
- case ShelfItemDelegate::kNoAction: |
- case ShelfItemDelegate::kExistingWindowActivated: |
- case ShelfItemDelegate::kExistingWindowMinimized: |
- case ShelfItemDelegate::kAppListMenuShown: |
- ShowListMenuForView(model_->items()[view_index], sender, event); |
- break; |
- case ShelfItemDelegate::kNewWindowCreated: |
- Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
- UMA_LAUNCHER_LAUNCH_TASK); |
- break; |
- } |
+ ShelfItemDelegate::PerformedAction performed_action = |
+ item_manager_->GetShelfItemDelegate(model_->items()[view_index].id) |
+ ->ItemSelected(event); |
+ |
+ RecordIconActivatedAction(performed_action); |
+ |
+ if (performed_action != ShelfItemDelegate::kNewWindowCreated) |
+ ShowListMenuForView(model_->items()[view_index], sender, event); |
+ } |
+} |
+ |
+void ShelfView::RecordIconActivatedSource(const ui::Event& event) { |
+ if (event.IsMouseEvent()) { |
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
+ UMA_LAUNCHER_BUTTON_PRESSED_WITH_MOUSE); |
+ } else if (event.IsGestureEvent()) { |
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
+ UMA_LAUNCHER_BUTTON_PRESSED_WITH_TOUCH); |
+ } |
+} |
+ |
+void ShelfView::RecordIconActivatedAction( |
+ ShelfItemDelegate::PerformedAction performed_action) { |
+ switch (performed_action) { |
+ case ShelfItemDelegate::kNoAction: |
+ case ShelfItemDelegate::kExistingWindowMinimized: |
+ case ShelfItemDelegate::kAppListMenuShown: |
+ break; |
+ case ShelfItemDelegate::kNewWindowCreated: |
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
+ UMA_LAUNCHER_LAUNCH_TASK); |
+ break; |
+ case ShelfItemDelegate::kExistingWindowActivated: |
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
+ UMA_LAUNCHER_SWITCH_TASK); |
+ break; |
} |
} |