OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/geolocation/GeoNotifier.h" | 5 #include "modules/geolocation/GeoNotifier.h" |
6 | 6 |
7 #include "modules/geolocation/Geolocation.h" | 7 #include "modules/geolocation/Geolocation.h" |
8 #include "modules/geolocation/PositionError.h" | 8 #include "modules/geolocation/PositionError.h" |
9 #include "modules/geolocation/PositionOptions.h" | 9 #include "modules/geolocation/PositionOptions.h" |
10 #include "platform/Histogram.h" | 10 #include "platform/Histogram.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 m_timer.startOneShot(m_options.timeout() / 1000.0, BLINK_FROM_HERE); | 69 m_timer.startOneShot(m_options.timeout() / 1000.0, BLINK_FROM_HERE); |
70 } | 70 } |
71 | 71 |
72 void GeoNotifier::stopTimer() { | 72 void GeoNotifier::stopTimer() { |
73 m_timer.stop(); | 73 m_timer.stop(); |
74 } | 74 } |
75 | 75 |
76 void GeoNotifier::timerFired(TimerBase*) { | 76 void GeoNotifier::timerFired(TimerBase*) { |
77 m_timer.stop(); | 77 m_timer.stop(); |
78 | 78 |
79 // Test for fatal error first. This is required for the case where the LocalFr
ame is | 79 // Test for fatal error first. This is required for the case where the |
80 // disconnected and requests are cancelled. | 80 // LocalFrame is disconnected and requests are cancelled. |
81 if (m_fatalError) { | 81 if (m_fatalError) { |
82 runErrorCallback(m_fatalError); | 82 runErrorCallback(m_fatalError); |
83 // This will cause this notifier to be deleted. | 83 // This will cause this notifier to be deleted. |
84 m_geolocation->fatalErrorOccurred(this); | 84 m_geolocation->fatalErrorOccurred(this); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 if (m_useCachedPosition) { | 88 if (m_useCachedPosition) { |
89 // Clear the cached position flag in case this is a watch request, which | 89 // Clear the cached position flag in case this is a watch request, which |
90 // will continue to run. | 90 // will continue to run. |
91 m_useCachedPosition = false; | 91 m_useCachedPosition = false; |
92 m_geolocation->requestUsesCachedPosition(this); | 92 m_geolocation->requestUsesCachedPosition(this); |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 if (m_errorCallback) | 96 if (m_errorCallback) |
97 m_errorCallback->handleEvent( | 97 m_errorCallback->handleEvent( |
98 PositionError::create(PositionError::kTimeout, "Timeout expired")); | 98 PositionError::create(PositionError::kTimeout, "Timeout expired")); |
99 | 99 |
100 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, | 100 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram, |
101 ("Geolocation.TimeoutExpired", 0, | 101 ("Geolocation.TimeoutExpired", 0, |
102 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); | 102 1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */)); |
103 timeoutExpiredHistogram.count(m_options.timeout()); | 103 timeoutExpiredHistogram.count(m_options.timeout()); |
104 | 104 |
105 m_geolocation->requestTimedOut(this); | 105 m_geolocation->requestTimedOut(this); |
106 } | 106 } |
107 | 107 |
108 } // namespace blink | 108 } // namespace blink |
OLD | NEW |