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

Side by Side Diff: Source/platform/UserGestureIndicator.cpp

Issue 1213003004: Fix virtual/override/final usage in Source/platform/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/TracedValue.h ('k') | Source/platform/animation/TimingFunction.h » ('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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 // User gestures timeout in 1 second. 37 // User gestures timeout in 1 second.
38 const double userGestureTimeout = 1.0; 38 const double userGestureTimeout = 1.0;
39 39
40 // For out of process tokens we allow a 10 second delay. 40 // For out of process tokens we allow a 10 second delay.
41 const double userGestureOutOfProcessTimeout = 10.0; 41 const double userGestureOutOfProcessTimeout = 10.0;
42 42
43 class GestureToken : public UserGestureToken { 43 class GestureToken : public UserGestureToken {
44 public: 44 public:
45 static PassRefPtr<UserGestureToken> create() { return adoptRef(new GestureTo ken); } 45 static PassRefPtr<UserGestureToken> create() { return adoptRef(new GestureTo ken); }
46 46
47 virtual ~GestureToken() { } 47 ~GestureToken() override {}
48 virtual bool hasGestures() const override 48 bool hasGestures() const override
49 { 49 {
50 // Do not enforce timeouts for gestures which spawned javascript prompts . 50 // Do not enforce timeouts for gestures which spawned javascript prompts .
51 if (m_consumableGestures < 1 || (WTF::currentTime() - m_timestamp > (m_o utOfProcess ? userGestureOutOfProcessTimeout : userGestureTimeout) && !m_javascr iptPrompt)) 51 if (m_consumableGestures < 1 || (WTF::currentTime() - m_timestamp > (m_o utOfProcess ? userGestureOutOfProcessTimeout : userGestureTimeout) && !m_javascr iptPrompt))
52 return false; 52 return false;
53 return true; 53 return true;
54 } 54 }
55 55
56 void addGesture() 56 void addGesture()
57 { 57 {
58 m_consumableGestures++; 58 m_consumableGestures++;
59 m_timestamp = WTF::currentTime(); 59 m_timestamp = WTF::currentTime();
60 } 60 }
61 61
62 void resetTimestamp() 62 void resetTimestamp()
63 { 63 {
64 m_timestamp = WTF::currentTime(); 64 m_timestamp = WTF::currentTime();
65 } 65 }
66 66
67 bool consumeGesture() 67 bool consumeGesture()
68 { 68 {
69 if (!m_consumableGestures) 69 if (!m_consumableGestures)
70 return false; 70 return false;
71 m_consumableGestures--; 71 m_consumableGestures--;
72 return true; 72 return true;
73 } 73 }
74 74
75 virtual void setOutOfProcess() override 75 void setOutOfProcess() override
76 { 76 {
77 if (WTF::currentTime() - m_timestamp > userGestureTimeout) 77 if (WTF::currentTime() - m_timestamp > userGestureTimeout)
78 return; 78 return;
79 if (hasGestures()) 79 if (hasGestures())
80 m_outOfProcess = true; 80 m_outOfProcess = true;
81 } 81 }
82 82
83 virtual void setJavascriptPrompt() override 83 void setJavascriptPrompt() override
84 { 84 {
85 if (WTF::currentTime() - m_timestamp > userGestureTimeout) 85 if (WTF::currentTime() - m_timestamp > userGestureTimeout)
86 return; 86 return;
87 if (hasGestures()) 87 if (hasGestures())
88 m_javascriptPrompt = true; 88 m_javascriptPrompt = true;
89 } 89 }
90 90
91 private: 91 private:
92 GestureToken() 92 GestureToken()
93 : m_consumableGestures(0) 93 : m_consumableGestures(0)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 bool UserGestureIndicator::processedUserGestureSinceLoad() 211 bool UserGestureIndicator::processedUserGestureSinceLoad()
212 { 212 {
213 if (!isMainThread()) 213 if (!isMainThread())
214 return false; 214 return false;
215 return s_processedUserGestureSinceLoad; 215 return s_processedUserGestureSinceLoad;
216 } 216 }
217 217
218 } 218 }
OLDNEW
« no previous file with comments | « Source/platform/TracedValue.h ('k') | Source/platform/animation/TimingFunction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698