| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/extensions/api/location/location_manager.h" | 5 #include "chrome/browser/extensions/api/location/location_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/extensions/event_router.h" | 9 #include "chrome/browser/extensions/event_router.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 if (position.speed >= 0.) | 193 if (position.speed >= 0.) |
| 194 coordinates->speed.reset(new double(position.speed)); | 194 coordinates->speed.reset(new double(position.speed)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void LocationManager::SendLocationUpdate( | 197 void LocationManager::SendLocationUpdate( |
| 198 const std::string& extension_id, | 198 const std::string& extension_id, |
| 199 const std::string& request_name, | 199 const std::string& request_name, |
| 200 const content::Geoposition& position) { | 200 const content::Geoposition& position) { |
| 201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 202 | 202 |
| 203 scoped_ptr<ListValue> args(new ListValue()); | 203 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 204 std::string event_name; | 204 std::string event_name; |
| 205 | 205 |
| 206 if (position.Validate() && | 206 if (position.Validate() && |
| 207 position.error_code == content::Geoposition::ERROR_CODE_NONE) { | 207 position.error_code == content::Geoposition::ERROR_CODE_NONE) { |
| 208 // Set data for onLocationUpdate event. | 208 // Set data for onLocationUpdate event. |
| 209 location::Location location; | 209 location::Location location; |
| 210 location.name = request_name; | 210 location.name = request_name; |
| 211 GeopositionToApiCoordinates(position, &location.coords); | 211 GeopositionToApiCoordinates(position, &location.coords); |
| 212 location.timestamp = position.timestamp.ToJsTime(); | 212 location.timestamp = position.timestamp.ToJsTime(); |
| 213 | 213 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 ProfileKeyedAPIFactory<LocationManager>* LocationManager::GetFactoryInstance() { | 266 ProfileKeyedAPIFactory<LocationManager>* LocationManager::GetFactoryInstance() { |
| 267 return &g_factory.Get(); | 267 return &g_factory.Get(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // static | 270 // static |
| 271 LocationManager* LocationManager::Get(Profile* profile) { | 271 LocationManager* LocationManager::Get(Profile* profile) { |
| 272 return ProfileKeyedAPIFactory<LocationManager>::GetForProfile(profile); | 272 return ProfileKeyedAPIFactory<LocationManager>::GetForProfile(profile); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace extensions | 275 } // namespace extensions |
| OLD | NEW |