| OLD | NEW |
| 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | |
| 11 | 10 |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/string16.h" | 15 #include "base/string16.h" |
| 17 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 18 #include "content/browser/geolocation/device_data_provider.h" | 17 #include "content/browser/geolocation/device_data_provider.h" |
| 19 #include "content/browser/geolocation/location_provider.h" | 18 #include "content/browser/geolocation/location_provider.h" |
| 20 #include "content/browser/geolocation/network_location_request.h" | 19 #include "content/browser/geolocation/network_location_request.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 net::URLRequestContextGetter* context, | 71 net::URLRequestContextGetter* context, |
| 73 const GURL& url, | 72 const GURL& url, |
| 74 const string16& access_token); | 73 const string16& access_token); |
| 75 virtual ~NetworkLocationProvider(); | 74 virtual ~NetworkLocationProvider(); |
| 76 | 75 |
| 77 // LocationProviderBase implementation | 76 // LocationProviderBase implementation |
| 78 virtual bool StartProvider(bool high_accuracy) OVERRIDE; | 77 virtual bool StartProvider(bool high_accuracy) OVERRIDE; |
| 79 virtual void StopProvider() OVERRIDE; | 78 virtual void StopProvider() OVERRIDE; |
| 80 virtual void GetPosition(Geoposition *position) OVERRIDE; | 79 virtual void GetPosition(Geoposition *position) OVERRIDE; |
| 81 virtual void UpdatePosition() OVERRIDE; | 80 virtual void UpdatePosition() OVERRIDE; |
| 82 virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE; | 81 virtual void OnPermissionGranted() OVERRIDE; |
| 83 | 82 |
| 84 private: | 83 private: |
| 85 // Satisfies a position request from cache or network. | 84 // Satisfies a position request from cache or network. |
| 86 void RequestPosition(); | 85 void RequestPosition(); |
| 87 | 86 |
| 88 // Internal helper used by DeviceDataUpdateAvailable | 87 // Internal helper used by DeviceDataUpdateAvailable |
| 89 void OnDeviceDataUpdated(); | 88 void OnDeviceDataUpdated(); |
| 90 | 89 |
| 91 bool IsStarted() const; | 90 bool IsStarted() const; |
| 92 | 91 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 116 // The timestamp for the latest device data update. | 115 // The timestamp for the latest device data update. |
| 117 base::Time device_data_updated_timestamp_; | 116 base::Time device_data_updated_timestamp_; |
| 118 | 117 |
| 119 // Cached value loaded from the token store or set by a previous server | 118 // Cached value loaded from the token store or set by a previous server |
| 120 // response, and sent in each subsequent network request. | 119 // response, and sent in each subsequent network request. |
| 121 string16 access_token_; | 120 string16 access_token_; |
| 122 | 121 |
| 123 // The current best position estimate. | 122 // The current best position estimate. |
| 124 Geoposition position_; | 123 Geoposition position_; |
| 125 | 124 |
| 125 // Whether permission has been granted for the provider to operate. |
| 126 bool is_permission_granted_; |
| 127 |
| 126 bool is_new_data_available_; | 128 bool is_new_data_available_; |
| 127 | 129 |
| 128 std::string most_recent_authorized_host_; | |
| 129 | |
| 130 // The network location request object, and the url it uses. | 130 // The network location request object, and the url it uses. |
| 131 scoped_ptr<NetworkLocationRequest> request_; | 131 scoped_ptr<NetworkLocationRequest> request_; |
| 132 | 132 |
| 133 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; | 133 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; |
| 134 // The cache of positions. | 134 // The cache of positions. |
| 135 scoped_ptr<PositionCache> position_cache_; | 135 scoped_ptr<PositionCache> position_cache_; |
| 136 | 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); | 137 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 140 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| OLD | NEW |