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

Unified Diff: ash/wm/stylus_metrics_recorder.cc

Issue 2331093002: UMA stats for stylus usage (Closed)
Patch Set: nit and rebase Created 4 years, 3 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/wm/stylus_metrics_recorder.h ('k') | chrome/browser/chromeos/note_taking_app_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/stylus_metrics_recorder.cc
diff --git a/ash/wm/stylus_metrics_recorder.cc b/ash/wm/stylus_metrics_recorder.cc
deleted file mode 100644
index def7706d45639c2eb7d3dd8385c238ce718eaf61..0000000000000000000000000000000000000000
--- a/ash/wm/stylus_metrics_recorder.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/stylus_metrics_recorder.h"
-
-#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
-#include "ash/common/wm_shell.h"
-#include "ash/shell.h"
-#include "base/metrics/histogram.h"
-#include "ui/events/event.h"
-#include "ui/events/event_constants.h"
-#include "ui/events/event_utils.h"
-
-namespace ash {
-
-// Form factor of the down event. This enum is used to back an UMA histogram
-// and should be treated as append-only.
-enum DownEventFormFactor {
- DOWN_EVENT_FORMFACTOR_CLAMSHELL = 0,
- DOWN_EVENT_FORMFACTOR_TOUCHVIEW,
- DOWN_EVENT_FORMFACTOR_COUNT
-};
-
-// Input type of the down event. This enum is used to back an UMA histogram
-// and should be treated as append-only.
-enum DownEventSource {
- DOWN_EVENT_SOURCE_UNKNOWN = 0,
- DOWN_EVENT_SOURCE_MOUSE,
- DOWN_EVENT_SOURCE_STYLUS,
- DOWN_EVENT_SOURCE_TOUCH,
- DOWN_EVENT_SOURCE_COUNT
-};
-
-StylusMetricsRecorder::StylusMetricsRecorder() {}
-
-StylusMetricsRecorder::~StylusMetricsRecorder() {}
-
-void StylusMetricsRecorder::OnMouseEvent(ui::MouseEvent* event) {
- if (event->type() != ui::ET_MOUSE_PRESSED)
- return;
- RecordUMA(event->pointer_details().pointer_type);
-}
-
-void StylusMetricsRecorder::OnTouchEvent(ui::TouchEvent* event) {
- if (event->type() != ui::ET_TOUCH_PRESSED)
- return;
- RecordUMA(event->pointer_details().pointer_type);
-}
-
-void StylusMetricsRecorder::RecordUMA(ui::EventPointerType type) {
- DownEventFormFactor form_factor = DOWN_EVENT_FORMFACTOR_CLAMSHELL;
- if (WmShell::Get()
- ->maximize_mode_controller()
- ->IsMaximizeModeWindowManagerEnabled()) {
- form_factor = DOWN_EVENT_FORMFACTOR_TOUCHVIEW;
- }
- UMA_HISTOGRAM_ENUMERATION("Event.DownEventCount.PerFormFactor", form_factor,
- DOWN_EVENT_FORMFACTOR_COUNT);
-
- DownEventSource input_type = DOWN_EVENT_SOURCE_UNKNOWN;
- switch (type) {
- case ui::EventPointerType::POINTER_TYPE_UNKNOWN:
- input_type = DOWN_EVENT_SOURCE_UNKNOWN;
- break;
- case ui::EventPointerType::POINTER_TYPE_MOUSE:
- input_type = DOWN_EVENT_SOURCE_MOUSE;
- break;
- case ui::EventPointerType::POINTER_TYPE_PEN:
- input_type = DOWN_EVENT_SOURCE_STYLUS;
- break;
- case ui::EventPointerType::POINTER_TYPE_TOUCH:
- input_type = DOWN_EVENT_SOURCE_TOUCH;
- break;
- case ui::EventPointerType::POINTER_TYPE_ERASER:
- input_type = DOWN_EVENT_SOURCE_STYLUS;
- break;
- }
-
- UMA_HISTOGRAM_ENUMERATION("Event.DownEventCount.PerInput", input_type,
- DOWN_EVENT_SOURCE_COUNT);
-}
-
-} // namespace ash
« no previous file with comments | « ash/wm/stylus_metrics_recorder.h ('k') | chrome/browser/chromeos/note_taking_app_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698