| 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 #ifndef DEVICE_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |   5 #ifndef CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ | 
|   6 #define DEVICE_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |   6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ | 
|   7  |   7  | 
|   8 #include <memory> |   8 #include <memory> | 
|   9  |   9  | 
|  10 #include "base/callback.h" |  10 #include "base/callback.h" | 
|  11 #include "base/macros.h" |  11 #include "base/macros.h" | 
|  12 #include "base/memory/ref_counted.h" |  12 #include "base/memory/ref_counted.h" | 
|  13 #include "base/strings/string16.h" |  13 #include "base/strings/string16.h" | 
|  14 #include "device/geolocation/geolocation_export.h" |  14 #include "content/browser/geolocation/wifi_data_provider.h" | 
|  15 #include "device/geolocation/wifi_data_provider.h" |  15 #include "content/common/content_export.h" | 
|  16 #include "net/url_request/url_fetcher_delegate.h" |  16 #include "net/url_request/url_fetcher_delegate.h" | 
|  17 #include "url/gurl.h" |  17 #include "url/gurl.h" | 
|  18  |  18  | 
|  19 namespace net { |  19 namespace net { | 
|  20 class URLFetcher; |  20 class URLFetcher; | 
|  21 class URLRequestContextGetter; |  21 class URLRequestContextGetter; | 
|  22 } |  22 } | 
|  23  |  23  | 
|  24 namespace device { |  24 namespace content { | 
|  25 struct Geoposition; |  25 struct Geoposition; | 
|  26  |  26  | 
|  27 // Takes wifi data and sends it to a server to get a position fix. |  27 // Takes wifi data and sends it to a server to get a position fix. | 
|  28 // It performs formatting of the request and interpretation of the response. |  28 // It performs formatting of the request and interpretation of the response. | 
|  29 class NetworkLocationRequest : private net::URLFetcherDelegate { |  29 class NetworkLocationRequest : private net::URLFetcherDelegate { | 
|  30  public: |  30  public: | 
|  31   // ID passed to URLFetcher::Create(). Used for testing. |  31   // ID passed to URLFetcher::Create(). Used for testing. | 
|  32   DEVICE_GEOLOCATION_EXPORT static int url_fetcher_id_for_tests; |  32   CONTENT_EXPORT static int url_fetcher_id_for_tests; | 
|  33  |  33  | 
|  34   // Called when a new geo position is available. The second argument indicates |  34   // Called when a new geo position is available. The second argument indicates | 
|  35   // whether there was a server error or not. It is true when there was a |  35   // whether there was a server error or not. It is true when there was a | 
|  36   // server or network error - either no response or a 500 error code. |  36   // server or network error - either no response or a 500 error code. | 
|  37   typedef base::Callback<void(const Geoposition& /* position */, |  37   typedef base::Callback<void(const Geoposition& /* position */, | 
|  38                               bool /* server_error */, |  38                               bool /* server_error */, | 
|  39                               const base::string16& /* access_token */, |  39                               const base::string16& /* access_token */, | 
|  40                               const WifiData& /* wifi_data */)> |  40                               const WifiData& /* wifi_data */)> | 
|  41       LocationResponseCallback; |  41       LocationResponseCallback; | 
|  42  |  42  | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  69   // when the response arrives. |  69   // when the response arrives. | 
|  70   WifiData wifi_data_; |  70   WifiData wifi_data_; | 
|  71   base::Time wifi_timestamp_; |  71   base::Time wifi_timestamp_; | 
|  72  |  72  | 
|  73   // The start time for the request. |  73   // The start time for the request. | 
|  74   base::TimeTicks request_start_time_; |  74   base::TimeTicks request_start_time_; | 
|  75  |  75  | 
|  76   DISALLOW_COPY_AND_ASSIGN(NetworkLocationRequest); |  76   DISALLOW_COPY_AND_ASSIGN(NetworkLocationRequest); | 
|  77 }; |  77 }; | 
|  78  |  78  | 
|  79 }  // namespace device |  79 }  // namespace content | 
|  80  |  80  | 
|  81 #endif  // DEVICE_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |  81 #endif  // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ | 
| OLD | NEW |