Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3516)

Unified Diff: blimp/common/logging.cc

Issue 2091023006: Adds EngineGeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/common/create_blimp_message.cc ('k') | blimp/common/proto/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/common/logging.cc
diff --git a/blimp/common/logging.cc b/blimp/common/logging.cc
index 24d6060adb37028eca7f1d7933fa481ef8e7c26b..0402aa1f22c53f4f2deb5bbdbcd301015b3ce55e 100644
--- a/blimp/common/logging.cc
+++ b/blimp/common/logging.cc
@@ -300,6 +300,43 @@ void ExtractBlobChannelMessageFields(const BlimpMessage& message,
}
}
+// Logs fields from GEOLOCATION messages.
+void ExtractGeolocationMessageFields(const BlimpMessage& message,
+ LogFields* output) {
+ switch (message.geolocation().type_case()) {
+ case GeolocationMessage::TypeCase::kSetInterestLevel:
+ AddField("subtype", "SET_INTEREST_LEVEL", output);
+ AddField("level", message.geolocation().set_interest_level().level(),
+ output);
+ break;
+ case GeolocationMessage::TypeCase::kRequestRefresh:
+ AddField("subtype", "REQUEST_REFRESH", output);
+ break;
+ case GeolocationMessage::TypeCase::kCoordinates: {
+ const GeolocationCoordinatesMessage& coordinates =
+ message.geolocation().coordinates();
+ AddField("subtype", "COORDINATES", output);
+ AddField("latitude", coordinates.latitude(), output);
+ AddField("longitude", coordinates.longitude(), output);
+ AddField("altitude", coordinates.altitude(), output);
+ AddField("accuracy", coordinates.accuracy(), output);
+ AddField("altitude_accuracy", coordinates.altitude_accuracy(), output);
+ AddField("heading", coordinates.heading(), output);
+ AddField("speed", coordinates.speed(), output);
+ break;
+ }
+ case GeolocationMessage::TypeCase::kError:
+ AddField("subtype", "ERROR", output);
+ AddField("error_code", message.geolocation().error().error_code(),
+ output);
+ AddField("error_message", message.geolocation().error().error_message(),
+ output);
+ break;
+ case GeolocationMessage::TypeCase::TYPE_NOT_SET:
+ break;
+ }
+}
+
} // namespace
std::ostream& operator<<(std::ostream& out, const BlimpMessage& message) {
@@ -342,6 +379,10 @@ std::ostream& operator<<(std::ostream& out, const BlimpMessage& message) {
AddField("type", "IME", &fields);
ExtractImeMessageFields(message, &fields);
break;
+ case BlimpMessage::kGeolocation:
+ AddField("type", "GEOLOCATION", &fields);
+ ExtractGeolocationMessageFields(message, &fields);
+ break;
case BlimpMessage::FEATURE_NOT_SET:
AddField("type", "<UNKNOWN>", &fields);
break;
« no previous file with comments | « blimp/common/create_blimp_message.cc ('k') | blimp/common/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698