| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ | 5 #ifndef CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ | 6 #define CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/chromeos/geolocation/simple_geolocation_request.h" | 13 #include "chromeos/chromeos_export.h" |
| 14 #include "chromeos/geolocation/simple_geolocation_request.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 | 22 |
| 22 // This class implements Google Maps Geolocation API. | 23 // This class implements Google Maps Geolocation API. |
| 23 // | 24 // |
| 24 // SimpleGeolocationProvider must be created and used on the same thread. | 25 // SimpleGeolocationProvider must be created and used on the same thread. |
| 25 // | 26 // |
| 26 // Note: this should probably be a singleton to monitor requests rate. | 27 // Note: this should probably be a singleton to monitor requests rate. |
| 27 // But as it is used only diring ChromeOS Out-of-Box, it can be owned by | 28 // But as it is used only diring ChromeOS Out-of-Box, it can be owned by |
| 28 // WizardController for now. | 29 // WizardController for now. |
| 29 class SimpleGeolocationProvider { | 30 class CHROMEOS_EXPORT SimpleGeolocationProvider { |
| 30 public: | 31 public: |
| 31 SimpleGeolocationProvider(net::URLRequestContextGetter* url_context_getter, | 32 SimpleGeolocationProvider(net::URLRequestContextGetter* url_context_getter, |
| 32 const GURL& url); | 33 const GURL& url); |
| 33 virtual ~SimpleGeolocationProvider(); | 34 virtual ~SimpleGeolocationProvider(); |
| 34 | 35 |
| 35 // Initiates new request (See SimpleGeolocationRequest for parameters | 36 // Initiates new request (See SimpleGeolocationRequest for parameters |
| 36 // description.) | 37 // description.) |
| 37 void RequestGeolocation(base::TimeDelta timeout, | 38 void RequestGeolocation(base::TimeDelta timeout, |
| 38 SimpleGeolocationRequest::ResponseCallback callback); | 39 SimpleGeolocationRequest::ResponseCallback callback); |
| 39 | 40 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 ScopedVector<SimpleGeolocationRequest> requests_; | 63 ScopedVector<SimpleGeolocationRequest> requests_; |
| 63 | 64 |
| 64 // Creation and destruction should happen on the same thread. | 65 // Creation and destruction should happen on the same thread. |
| 65 base::ThreadChecker thread_checker_; | 66 base::ThreadChecker thread_checker_; |
| 66 | 67 |
| 67 DISALLOW_COPY_AND_ASSIGN(SimpleGeolocationProvider); | 68 DISALLOW_COPY_AND_ASSIGN(SimpleGeolocationProvider); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace chromeos | 71 } // namespace chromeos |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ | 73 #endif // CHROMEOS_GEOLOCATION_SIMPLE_GEOLOCATION_PROVIDER_H_ |
| OLD | NEW |