Implement proximity_auth::WireMessage::Serialize().
[chromium-blink-merge.git] / chromeos / geolocation / geoposition.h
blob543e3ed924201f6cd57a728374ab01d9ddf0c7fb
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_GEOLOCATION_GEOPOSITION_H_
6 #define CHROMEOS_GEOLOCATION_GEOPOSITION_H_
8 #include <string>
10 #include "base/time/time.h"
11 #include "chromeos/chromeos_export.h"
13 namespace chromeos {
15 // This structure represents Google Maps Geolocation response.
16 // Based on content/public/common/geoposition.h .
17 struct CHROMEOS_EXPORT Geoposition {
18 // Geolocation API client status.
19 // (Server status is reported in "error_code" field.)
20 enum Status {
21 STATUS_NONE,
22 STATUS_OK, // Response successful.
23 STATUS_SERVER_ERROR, // Received error object.
24 STATUS_NETWORK_ERROR, // Received bad or no response.
25 STATUS_TIMEOUT, // Request stopped because of timeout.
26 STATUS_LAST = STATUS_TIMEOUT
29 // All fields are initialized to sentinel values marking them as invalid. The
30 // status is set to STATUS_NONE.
31 Geoposition();
33 // A valid fix has a valid latitude, longitude, accuracy and timestamp.
34 bool Valid() const;
36 // Serialize to string.
37 std::string ToString() const;
39 // Latitude in decimal degrees north.
40 double latitude;
42 // Longitude in decimal degrees west.
43 double longitude;
45 // Accuracy of horizontal position in meters.
46 double accuracy;
48 // Error object data:
49 // Value of "error.code".
50 int error_code;
52 // Human-readable error message.
53 std::string error_message;
55 // Absolute time, when this position was acquired. This is
56 // taken from the host computer's system clock (i.e. from Time::Now(), not the
57 // source device's clock).
58 base::Time timestamp;
60 // See enum above.
61 Status status;
64 } // namespace chromeos
66 #endif // CHROMEOS_GEOLOCATION_GEOPOSITION_H_