Chromium Code Reviews| Index: blimp/common/proto/geolocation.proto |
| diff --git a/blimp/common/proto/geolocation.proto b/blimp/common/proto/geolocation.proto |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b5af2384214eec85f90c69323d72ea007a3950c7 |
| --- /dev/null |
| +++ b/blimp/common/proto/geolocation.proto |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +// |
| +// Message definitions for geolocation messages. |
| + |
| +syntax = "proto2"; |
| + |
| +option optimize_for = LITE_RUNTIME; |
| + |
| +import "common.proto"; |
| + |
| +package blimp; |
| + |
| +message ErrorMessage { |
|
Wez
2016/07/12 21:35:12
Remember that message names are scoped to the pack
CJ
2016/07/13 21:49:19
Done.
|
| + // These values follow the W3C geolocation specification and can be returned |
| + // to JavaScript without the need for a conversion. |
|
Wez
2016/07/12 21:35:12
The Blink interface for PositionError (see https:/
CJ
2016/07/13 21:49:19
Removed comment.
|
| + // https://dev.w3.org/geo/api/spec-source.html - 5.5 PositionError interface |
| + enum ErrorCode { |
| + ERROR_CODE_NONE = 0; |
|
Wez
2016/07/12 21:35:12
Do we need NONE as an error enum value? Surely by
CJ
2016/07/13 21:49:19
Sure. Good point. Since I'm making a different mes
|
| + ERROR_CODE_PERMISSION_DENIED = 1; |
| + ERROR_CODE_POSITION_UNAVAILABLE = 2; |
| + ERROR_CODE_TIMEOUT = 3; |
| + } |
| + |
| + optional ErrorCode error_code = 1; |
| + optional string error_message = 2; |
| +} |
| + |
| +message LocationMessage { |
|
Wez
2016/07/12 21:35:12
nit: We should use either Location or Geolocation
CJ
2016/07/13 21:49:19
Done.
|
| + // Refer to content/public/common/geoposition.h for explanation of |
|
Wez
2016/07/12 21:35:12
geoposition.h is part of the Chromium-specific Con
CJ
2016/07/13 21:49:19
Added GeolocationCoordinates.
As for the comment
|
| + // these fields and associated units. |
| + optional double latitude = 1; |
| + optional double longitude = 2; |
| + optional double altitude = 3; |
| + optional double accuracy = 4; |
| + optional double altitude_accuracy = 5; |
| + optional double heading = 6; |
| + optional double speed = 7; |
| + optional int64 timestamp_millis = 8; |
| +} |
| + |
| +message UpdateListenStateMessage { |
|
Wez
2016/07/12 21:35:12
nit: Suggest GeolocationRequestMessage, Geolocatio
CJ
2016/07/13 21:49:19
Done.
|
| + // These values represent the various listening states the server can have. |
| + // A ListenState containing an accuracy level indicates that the server is |
| + // waiting for either high or low accuracy position updates from the client. |
| + // If a STOPPED listen state is sent, the server is no longer listening for |
| + // updates. |
| + enum ListenState { |
| + STOPPED = 0; |
| + ACCURACY_HIGH = 1; |
| + ACCURACY_LOW = 2; |
| + } |
| + |
| + optional ListenState listen_state = 1; |
| +} |
| + |
| +message GeolocationMessage { |
| + oneof type { |
| + // Server => Client types. |
| + UpdateListenStateMessage update_listen_state = 1; |
| + EmptyMessage request_refresh = 2; |
| + |
| + // Client => Server types. |
| + LocationMessage location = 3; |
| + ErrorMessage error = 4; |
| + } |
| +} |