| 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_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/browser/geolocation/device_data_provider.h" | 12 #include "content/browser/geolocation/device_data_provider.h" |
| 15 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 16 #include "content/public/common/url_fetcher_delegate.h" | 14 #include "content/public/common/url_fetcher_delegate.h" |
| 17 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 18 | 16 |
| 19 struct Geoposition; | 17 struct Geoposition; |
| 20 class URLFetcher; | 18 class URLFetcher; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 }; | 44 }; |
| 47 | 45 |
| 48 // |url| is the server address to which the request wil be sent. | 46 // |url| is the server address to which the request wil be sent. |
| 49 NetworkLocationRequest(net::URLRequestContextGetter* context, | 47 NetworkLocationRequest(net::URLRequestContextGetter* context, |
| 50 const GURL& url, | 48 const GURL& url, |
| 51 ListenerInterface* listener); | 49 ListenerInterface* listener); |
| 52 virtual ~NetworkLocationRequest(); | 50 virtual ~NetworkLocationRequest(); |
| 53 | 51 |
| 54 // Makes a new request. Returns true if the new request was successfully | 52 // Makes a new request. Returns true if the new request was successfully |
| 55 // started. In all cases, any currently pending request will be canceled. | 53 // started. In all cases, any currently pending request will be canceled. |
| 56 bool MakeRequest(const std::string& host, | 54 bool MakeRequest(const string16& access_token, |
| 57 const string16& access_token, | |
| 58 const RadioData& radio_data, | 55 const RadioData& radio_data, |
| 59 const WifiData& wifi_data, | 56 const WifiData& wifi_data, |
| 60 const base::Time& timestamp); | 57 const base::Time& timestamp); |
| 61 | 58 |
| 62 bool is_request_pending() const { return url_fetcher_ != NULL; } | 59 bool is_request_pending() const { return url_fetcher_ != NULL; } |
| 63 const GURL& url() const { return url_; } | 60 const GURL& url() const { return url_; } |
| 64 | 61 |
| 65 private: | 62 private: |
| 66 // content::URLFetcherDelegate | 63 // content::URLFetcherDelegate |
| 67 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 64 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 68 | 65 |
| 69 scoped_refptr<net::URLRequestContextGetter> url_context_; | 66 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 70 ListenerInterface* listener_; | 67 ListenerInterface* listener_; |
| 71 const GURL url_; | 68 const GURL url_; |
| 72 scoped_ptr<content::URLFetcher> url_fetcher_; | 69 scoped_ptr<content::URLFetcher> url_fetcher_; |
| 73 | 70 |
| 74 // Keep a copy of the data sent in the request, so we can refer back to it | 71 // Keep a copy of the data sent in the request, so we can refer back to it |
| 75 // when the response arrives. | 72 // when the response arrives. |
| 76 RadioData radio_data_; | 73 RadioData radio_data_; |
| 77 WifiData wifi_data_; | 74 WifiData wifi_data_; |
| 78 base::Time timestamp_; // Timestamp of the above data, not of the request. | 75 base::Time timestamp_; // Timestamp of the above data, not of the request. |
| 79 | 76 |
| 80 DISALLOW_COPY_AND_ASSIGN(NetworkLocationRequest); | 77 DISALLOW_COPY_AND_ASSIGN(NetworkLocationRequest); |
| 81 }; | 78 }; |
| 82 | 79 |
| 83 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ | 80 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_REQUEST_H_ |
| OLD | NEW |