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

Unified Diff: chrome/common/extensions/dial_device_description_parser_struct_traits.h

Issue 2745653008: [Media Router] Parse device description xml in utility process (Closed)
Patch Set: use mojo instead of IPC Created 3 years, 9 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/common/extensions/dial_device_description_parser_struct_traits.h
diff --git a/chrome/common/extensions/dial_device_description_parser_struct_traits.h b/chrome/common/extensions/dial_device_description_parser_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e3750b49f5091f3fc30f25c1fa0351239da94a5
--- /dev/null
+++ b/chrome/common/extensions/dial_device_description_parser_struct_traits.h
@@ -0,0 +1,44 @@
+// Copyright 2017 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.
+
+#ifndef CHROME_COMMON_EXTENSIONS_DIAL_DEVICE_DESCRIPTION_PARSER_STRUCT_TRAITS_H_
+#define CHROME_COMMON_EXTENSIONS_DIAL_DEVICE_DESCRIPTION_PARSER_STRUCT_TRAITS_H_
+
+#include <string>
+
+#include "chrome/common/extensions/dial_device_description_parser.mojom.h"
+#include "chrome/common/media_router/dial_device_description.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<extensions::mojom::DialDeviceDescriptionDataView,
+ media_router::DialDeviceDescription> {
+ static const std::string& unique_id(
+ const media_router::DialDeviceDescription& description) {
+ return description.unique_id;
+ }
+
+ static const std::string& friendly_name(
+ const media_router::DialDeviceDescription& description) {
+ return description.friendly_name;
+ }
+
+ static const std::string& model_name(
+ const media_router::DialDeviceDescription& description) {
+ return description.model_name;
+ }
+
+ static const std::string& device_type(
+ const media_router::DialDeviceDescription& description) {
+ return description.device_type;
+ }
+
+ static bool Read(extensions::mojom::DialDeviceDescriptionDataView data,
+ media_router::DialDeviceDescription* out);
+};
+
+} // namespace mojo
+
+#endif // CHROME_COMMON_EXTENSIONS_DIAL_DEVICE_DESCRIPTION_PARSER_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698