Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_ | |
| 6 #define CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #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
| |
| 10 #include "ui/views/pointer_watcher.h" | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Point; | |
| 14 } | |
| 15 | |
| 16 namespace ui { | |
| 17 class PointerEvent; | |
| 18 } | |
| 19 | |
| 20 namespace chromeos { | |
| 21 | |
| 22 // Form factor of the down event. This enum is used to back an UMA histogram | |
| 23 // and should be treated as append-only. | |
| 24 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.
| |
| 25 DOWN_EVENT_FORMFACTOR_CLAMSHELL = 0, | |
| 26 DOWN_EVENT_FORMFACTOR_TOUCHVIEW, | |
| 27 DOWN_EVENT_FORMFACTOR_COUNT | |
| 28 }; | |
| 29 | |
| 30 // Input type of the down event. This enum is used to back an UMA | |
| 31 // histogram and should be treated as append-only. | |
| 32 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.
| |
| 33 DOWN_EVENT_SOURCE_UNKNOWN = 0, | |
| 34 DOWN_EVENT_SOURCE_MOUSE, | |
| 35 DOWN_EVENT_SOURCE_STYLUS, | |
| 36 DOWN_EVENT_SOURCE_TOUCH, | |
| 37 DOWN_EVENT_SOURCE_COUNT | |
| 38 }; | |
| 39 | |
| 40 // Destination of the down event. This enum is used to back | |
| 41 // an UMA histogram and should be treated as append-only. | |
| 42 enum DownEventDestination { | |
| 43 DOWN_EVENT_DESTINATION_OTHERS = 0, | |
| 44 DOWN_EVENT_DESTINATION_SYSTEM_UI, | |
| 45 DOWN_EVENT_DESTINATION_WEBSITE, | |
| 46 DOWN_EVENT_DESTINATION_ARC_APP, | |
| 47 DOWN_EVENT_DESTINATION_NOTE_TAKING_APP, | |
| 48 DOWN_EVENT_DESTINATION_COUNT | |
| 49 }; | |
| 50 | |
| 51 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
| |
| 52 WINDOW_TYPE_OTHERS = 0, | |
| 53 WINDOW_TYPE_APP, | |
| 54 WINDOW_TYPE_BROWSER_WINDOW | |
| 55 }; | |
| 56 | |
| 57 // An metrics recorder that record stylus related metrics. | |
| 58 class StylusMetricsRecorder : public views::PointerWatcher { | |
| 59 public: | |
| 60 StylusMetricsRecorder(); | |
| 61 ~StylusMetricsRecorder() override; | |
| 62 | |
| 63 private: | |
| 64 // views::PointerWatcher: | |
| 65 void OnPointerEventObserved(const ui::PointerEvent& event, | |
| 66 const gfx::Point& location_in_screen, | |
| 67 views::Widget* target) override; | |
| 68 | |
| 69 void RecordUMA(ui::EventPointerType type, views::Widget* target); | |
| 70 | |
| 71 bool IsEventOnShelf(views::Widget* target); | |
| 72 | |
| 73 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.
| |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(StylusMetricsRecorder); | |
| 76 }; | |
| 77 | |
| 78 } // namespace chromeos | |
| 79 | |
| 80 #endif // CHROME_BROWSER_UI_ASH_METRICS_STYLUS_METRICS_RECORDER_H_ | |
| OLD | NEW |