Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2138)

Unified Diff: ash/shelf/shelf_view.cc

Issue 1097393002: Added Launcher_SwitchTask UMA user action. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698