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

Unified Diff: chrome/browser/ui/ash/metrics/stylus_metrics_recorder.h

Issue 2331093002: UMA stats for stylus usage (Closed)
Patch Set: 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
Index: chrome/browser/ui/ash/metrics/stylus_metrics_recorder.h
diff --git a/chrome/browser/ui/ash/metrics/stylus_metrics_recorder.h b/chrome/browser/ui/ash/metrics/stylus_metrics_recorder.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f74ce7c5cd7d0066804fbde22f71672da590334
--- /dev/null
+++ b/chrome/browser/ui/ash/metrics/stylus_metrics_recorder.h
@@ -0,0 +1,80 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_
+#define CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_
+
+#include "base/macros.h"
+#include "ui/aura/client/aura_constants.h"
sky 2016/09/13 00:03:26 Can this include be moved to .cc?
xiaoyinh(OOO Sep 11-29) 2016/09/16 18:41:16 I moved the window property key out of aura::clien
+#include "ui/views/pointer_watcher.h"
+
+namespace gfx {
+class Point;
+}
+
+namespace ui {
+class PointerEvent;
+}
+
+namespace chromeos {
+
+// Form factor of the down event. This enum is used to back an UMA histogram
+// and should be treated as append-only.
+enum DownEventFormFactor {
sky 2016/09/13 00:03:26 Please use enum class.
xiaoyinh(OOO Sep 11-29) 2016/09/16 18:41:16 Thanks! I've made StylusWindowType as enum class.
+ 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 {
sky 2016/09/13 00:03:26 Move enums that are only used in the .cc into the
xiaoyinh(OOO Sep 11-29) 2016/09/16 18:41:16 Done.
+ DOWN_EVENT_SOURCE_UNKNOWN = 0,
+ DOWN_EVENT_SOURCE_MOUSE,
+ DOWN_EVENT_SOURCE_STYLUS,
+ DOWN_EVENT_SOURCE_TOUCH,
+ DOWN_EVENT_SOURCE_COUNT
+};
+
+// Destination of the down event. This enum is used to back
+// an UMA histogram and should be treated as append-only.
+enum DownEventDestination {
+ DOWN_EVENT_DESTINATION_OTHERS = 0,
+ DOWN_EVENT_DESTINATION_SYSTEM_UI,
+ DOWN_EVENT_DESTINATION_WEBSITE,
+ DOWN_EVENT_DESTINATION_ARC_APP,
+ DOWN_EVENT_DESTINATION_NOTE_TAKING_APP,
+ DOWN_EVENT_DESTINATION_COUNT
+};
+
+enum StylusWindowType {
xiyuan 2016/09/12 20:15:47 Are those enums used elsewhere? If not, let's move
xiaoyinh(OOO Sep 11-29) 2016/09/16 18:41:16 Yes, they are being used when set the window prope
+ WINDOW_TYPE_OTHERS = 0,
+ WINDOW_TYPE_APP,
+ WINDOW_TYPE_BROWSER_WINDOW
+};
+
+// An metrics recorder that record stylus related metrics.
+class StylusMetricsRecorder : public views::PointerWatcher {
+ public:
+ StylusMetricsRecorder();
+ ~StylusMetricsRecorder() override;
+
+ private:
+ // views::PointerWatcher:
+ void OnPointerEventObserved(const ui::PointerEvent& event,
+ const gfx::Point& location_in_screen,
+ views::Widget* target) override;
+
+ void RecordUMA(ui::EventPointerType type, views::Widget* target);
+
+ bool IsEventOnShelf(views::Widget* target);
+
+ DownEventDestination GetDownEventDestination(views::Widget* target);
xiyuan 2016/09/12 20:15:47 RecordUMA, IsEventOnShelf and GetDownEventDestinat
xiaoyinh(OOO Sep 11-29) 2016/09/16 18:41:16 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(StylusMetricsRecorder);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_

Powered by Google App Engine
This is Rietveld 408576698