Add a new CefGetGeolocation function for retrieving geolocation information via an API callback (issue #764).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@868 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-10-19 18:39:44 +00:00
parent e1f2be1785
commit e45ff9e838
15 changed files with 754 additions and 1 deletions

View File

@@ -1321,6 +1321,74 @@ enum cef_file_dialog_mode_t {
FILE_DIALOG_SAVE,
};
///
// Geoposition error codes.
///
enum cef_geoposition_error_code_t {
GEOPOSITON_ERROR_NONE = 0,
GEOPOSITON_ERROR_PERMISSION_DENIED,
GEOPOSITON_ERROR_POSITION_UNAVAILABLE,
GEOPOSITON_ERROR_TIMEOUT,
};
///
// Structure representing geoposition information. The properties of this
// structure correspond to those of the JavaScript Position object although
// their types may differ.
///
typedef struct _cef_geoposition_t {
///
// Latitude in decimal degrees north (WGS84 coordinate frame).
///
double latitude;
///
// Longitude in decimal degrees west (WGS84 coordinate frame).
///
double longitude;
///
// Altitude in meters (above WGS84 datum).
///
double altitude;
///
// Accuracy of horizontal position in meters.
///
double accuracy;
///
// Accuracy of altitude in meters.
///
double altitude_accuracy;
///
// Heading in decimal degrees clockwise from true north.
///
double heading;
///
// Horizontal component of device velocity in meters per second.
///
double speed;
///
// Time of position measurement in miliseconds since Epoch in UTC time. This
// is taken from the host computer's system clock.
///
cef_time_t timestamp;
///
// Error code, see enum above.
///
cef_geoposition_error_code_t error_code;
///
// Human-readable error message.
///
cef_string_t error_message;
} cef_geoposition_t;
#ifdef __cplusplus
}
#endif

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -589,4 +589,34 @@ class CefProxyInfo : public CefStructBase<CefProxyInfoTraits> {
CefString ProxyList() const { return CefString(&proxyList); }
};
struct CefGeopositionTraits {
typedef cef_geoposition_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {
cef_string_clear(&s->error_message);
}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
target->latitude = src->latitude;
target->longitude = src->longitude;
target->altitude = src->altitude;
target->accuracy = src->accuracy;
target->altitude_accuracy = src->altitude_accuracy;
target->heading = src->heading;
target->speed = src->speed;
target->timestamp = src->timestamp;
target->error_code = src->error_code;
cef_string_set(src->error_message.str, src->error_message.length,
&target->error_message, copy);
}
};
///
// Class representing a geoposition.
///
typedef CefStructBase<CefGeopositionTraits> CefGeoposition;
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_