OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/geolocation/win7_location_provider_win.h" | 5 #include "content/browser/geolocation/win7_location_provider_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 ScheduleNextPoll(differ ? kPollPeriodMovingMillis : | 84 ScheduleNextPoll(differ ? kPollPeriodMovingMillis : |
85 kPollPeriodStationaryMillis); | 85 kPollPeriodStationaryMillis); |
86 if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) { | 86 if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) { |
87 // Update if the new location is interesting or we have an error to report | 87 // Update if the new location is interesting or we have an error to report |
88 position_ = new_position; | 88 position_ = new_position; |
89 UpdateListeners(); | 89 UpdateListeners(); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void Win7LocationProvider::ScheduleNextPoll(int interval) { | 93 void Win7LocationProvider::ScheduleNextPoll(int interval) { |
94 MessageLoop::current()->PostDelayedTask( | 94 base::MessageLoop::current()->PostDelayedTask( |
95 FROM_HERE, | 95 FROM_HERE, |
96 base::Bind(&Win7LocationProvider::DoPollTask, weak_factory_.GetWeakPtr()), | 96 base::Bind(&Win7LocationProvider::DoPollTask, weak_factory_.GetWeakPtr()), |
97 base::TimeDelta::FromMilliseconds(interval)); | 97 base::TimeDelta::FromMilliseconds(interval)); |
98 } | 98 } |
99 | 99 |
100 LocationProviderBase* NewSystemLocationProvider() { | 100 LocationProviderBase* NewSystemLocationProvider() { |
101 Win7LocationApi* api = Win7LocationApi::Create(); | 101 Win7LocationApi* api = Win7LocationApi::Create(); |
102 if (api == NULL) | 102 if (api == NULL) |
103 return NULL; // API not supported on this machine. | 103 return NULL; // API not supported on this machine. |
104 return new Win7LocationProvider(api); | 104 return new Win7LocationProvider(api); |
105 } | 105 } |
106 | 106 |
107 } // namespace content | 107 } // namespace content |
OLD | NEW |