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

Unified Diff: chrome/browser/local_discovery/device_description.cc

Issue 318893002: Added DeviceDescription::version with Privet version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thu 06/05/2014 11:30:37.29 Created 6 years, 6 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
Index: chrome/browser/local_discovery/device_description.cc
diff --git a/chrome/browser/local_discovery/device_description.cc b/chrome/browser/local_discovery/device_description.cc
index 8f4e3690294cee1079d76885b8baf51a7680288c..d2faed066544d1082ff9f8a6ed47ad6924906e76 100644
--- a/chrome/browser/local_discovery/device_description.cc
+++ b/chrome/browser/local_discovery/device_description.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/local_discovery/privet_constants.h"
#include "chrome/common/local_discovery/service_discovery_client.h"
@@ -31,6 +32,14 @@ ConnectionStateFromString(const std::string& str) {
} // namespace
+DeviceDescription::DeviceDescription()
+ : version(0),
+ connection_state(UNKNOWN) {
+}
+
+DeviceDescription::~DeviceDescription() {
+}
+
void DeviceDescription::FillFromServiceDescription(
const ServiceDescription& service_description) {
address = service_description.address;
@@ -48,7 +57,10 @@ void DeviceDescription::FillFromServiceDescription(
std::string key = i->substr(0, equals_pos);
std::string value = i->substr(equals_pos + 1);
- if (LowerCaseEqualsASCII(key, kPrivetTxtKeyName)) {
+ if (LowerCaseEqualsASCII(key, kPrivetTxtKeyVersion)) {
+ if (!base::StringToInt(value, &version))
+ continue; // Unknown version.
+ } else if (LowerCaseEqualsASCII(key, kPrivetTxtKeyName)) {
name = value;
} else if (LowerCaseEqualsASCII(key, kPrivetTxtKeyDescription)) {
description = value;
« no previous file with comments | « chrome/browser/local_discovery/device_description.h ('k') | chrome/browser/local_discovery/privet_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698