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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/NavigatorVibration.h

Issue 2082463002: Measure the usage of navigator.vibrate in for user gesture & subframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back NavigatorVibrateSubFrame UserCounter since we decide to go ahead to remove vibrate from if… Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Samsung Electronics 2 * Copyright (C) 2012 Samsung Electronics
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 15 matching lines...) Expand all
26 #include "platform/heap/GarbageCollected.h" 26 #include "platform/heap/GarbageCollected.h"
27 #include "platform/heap/Handle.h" 27 #include "platform/heap/Handle.h"
28 #include "wtf/Noncopyable.h" 28 #include "wtf/Noncopyable.h"
29 #include "wtf/Vector.h" 29 #include "wtf/Vector.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class Navigator; 33 class Navigator;
34 class VibrationController; 34 class VibrationController;
35 35
36 enum NavigatorVibrationType {
37 MainFrameNoUserGesture = 0,
38 MainFrameWithUserGesture = 1,
39 SameOriginSubFrameNoUserGesture = 2,
40 SameOriginSubFrameWithUserGesture = 3,
41 CrossOriginSubFrameNoUserGesture = 4,
42 CrossOriginSubFrameWithUserGesture = 5,
43 EnumMax = 6
44 };
45
36 class MODULES_EXPORT NavigatorVibration final 46 class MODULES_EXPORT NavigatorVibration final
37 : public GarbageCollectedFinalized<NavigatorVibration> 47 : public GarbageCollectedFinalized<NavigatorVibration>
38 , public Supplement<Navigator> 48 , public Supplement<Navigator>
39 , public DOMWindowProperty { 49 , public DOMWindowProperty {
40 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVibration); 50 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVibration);
41 WTF_MAKE_NONCOPYABLE(NavigatorVibration); 51 WTF_MAKE_NONCOPYABLE(NavigatorVibration);
42 public: 52 public:
43 using VibrationPattern = Vector<unsigned>; 53 using VibrationPattern = Vector<unsigned>;
44 54
45 virtual ~NavigatorVibration(); 55 virtual ~NavigatorVibration();
46 56
47 static NavigatorVibration& from(Navigator&); 57 static NavigatorVibration& from(Navigator&);
48 58
49 static bool vibrate(Navigator&, unsigned time); 59 static bool vibrate(Navigator&, unsigned time);
50 static bool vibrate(Navigator&, const VibrationPattern&); 60 static bool vibrate(Navigator&, const VibrationPattern&);
51 61
52 VibrationController* controller(); 62 VibrationController* controller();
53 63
54 DECLARE_VIRTUAL_TRACE(); 64 DECLARE_VIRTUAL_TRACE();
55 65
56 private: 66 private:
57 static const char* supplementName(); 67 static const char* supplementName();
58 68
59 explicit NavigatorVibration(Navigator&); 69 explicit NavigatorVibration(Navigator&);
60 70
61 // Inherited from DOMWindowProperty. 71 // Inherited from DOMWindowProperty.
62 void willDetachGlobalObjectFromFrame() override; 72 void willDetachGlobalObjectFromFrame() override;
63 73
74 static void collectHistogramMetrics(const LocalFrame&);
75
64 Member<VibrationController> m_controller; 76 Member<VibrationController> m_controller;
65 }; 77 };
66 78
67 } // namespace blink 79 } // namespace blink
68 80
69 #endif // NavigatorVibration_h 81 #endif // NavigatorVibration_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698