Chromium Code Reviews| 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 CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ | 6 #define CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 struct Geoposition; | 15 struct Geoposition; |
| 14 | 16 |
| 15 typedef base::Callback<void(const Geoposition&)> GeolocationUpdateCallback; | 17 typedef base::Callback<void(const Geoposition&)> GeolocationUpdateCallback; |
| 16 | 18 |
| 19 // Uniquely identifies a particular geolocation permission request. | |
| 20 struct CONTENT_EXPORT GeolocationPermissionRequestID { | |
| 21 GeolocationPermissionRequestID(int render_process_id, | |
| 22 int render_view_id, | |
| 23 int bridge_id); | |
| 24 | |
| 25 bool Equals(const GeolocationPermissionRequestID& other) const; | |
|
Jói
2012/10/24 09:48:36
I think our coding style only allows constructor,
jam
2012/10/24 16:39:43
you're right, the style guide is specific that if
| |
| 26 bool IsForSameTabAs(const GeolocationPermissionRequestID& other) const; | |
| 27 std::string ToString() const; | |
| 28 | |
| 29 int render_process_id; | |
| 30 int render_view_id; | |
| 31 int bridge_id; | |
| 32 }; | |
| 33 | |
| 17 // Overrides the current location for testing. This function may be called on | 34 // Overrides the current location for testing. This function may be called on |
| 18 // any thread. The completion callback will be invoked asynchronously on the | 35 // any thread. The completion callback will be invoked asynchronously on the |
| 19 // calling thread when the override operation is completed. | 36 // calling thread when the override operation is completed. |
| 20 // | 37 // |
| 21 // This function allows the current location to be faked without having to | 38 // This function allows the current location to be faked without having to |
| 22 // manually instantiate a GeolocationProvider backed by a MockLocationProvider | 39 // manually instantiate a GeolocationProvider backed by a MockLocationProvider |
| 23 // that serves a fake location. | 40 // that serves a fake location. |
| 24 // | 41 // |
| 25 // Do not use this function in unit tests. The function instantiates the | 42 // Do not use this function in unit tests. The function instantiates the |
| 26 // singleton geolocation stack in the background and manipulates it to report | 43 // singleton geolocation stack in the background and manipulates it to report |
| 27 // a fake location. Neither step can be undone, breaking unit test isolation | 44 // a fake location. Neither step can be undone, breaking unit test isolation |
| 28 // (crbug.com/125931). | 45 // (crbug.com/125931). |
| 29 void CONTENT_EXPORT OverrideLocationForTesting( | 46 void CONTENT_EXPORT OverrideLocationForTesting( |
| 30 const Geoposition& position, | 47 const Geoposition& position, |
| 31 const base::Closure& completion_callback); | 48 const base::Closure& completion_callback); |
| 32 | 49 |
| 33 // Requests a one-time callback when the next location update becomes available. | 50 // Requests a one-time callback when the next location update becomes available. |
| 34 // This function may be called on any thread. The callback will be invoked on | 51 // This function may be called on any thread. The callback will be invoked on |
| 35 // the calling thread. | 52 // the calling thread. |
| 36 void CONTENT_EXPORT RequestLocationUpdate( | 53 void CONTENT_EXPORT RequestLocationUpdate( |
| 37 const GeolocationUpdateCallback& callback); | 54 const GeolocationUpdateCallback& callback); |
| 38 | 55 |
| 39 } // namespace content | 56 } // namespace content |
| 40 | 57 |
| 41 #endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ | 58 #endif // CONTENT_PUBLIC_BROWSER_GEOLOCATION_H_ |
| OLD | NEW |