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

Side by Side Diff: chrome/utility/media_router/dial_device_description_parser_impl.cc

Issue 2867713002: Use OnceCallback on Mojo interfaces in //chrome/common/media_router (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/utility/media_router/dial_device_description_parser_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/media_router/dial_device_description_parser_impl.h" 5 #include "chrome/utility/media_router/dial_device_description_parser_impl.h"
6 6
7 #include <libxml/parser.h> 7 #include <libxml/parser.h>
8 #include <libxml/tree.h> 8 #include <libxml/tree.h>
9 #include <libxml/xpath.h> 9 #include <libxml/xpath.h>
10 #include <utility> 10 #include <utility>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // static 56 // static
57 void DialDeviceDescriptionParserImpl::Create( 57 void DialDeviceDescriptionParserImpl::Create(
58 const service_manager::BindSourceInfo& source_info, 58 const service_manager::BindSourceInfo& source_info,
59 chrome::mojom::DialDeviceDescriptionParserRequest request) { 59 chrome::mojom::DialDeviceDescriptionParserRequest request) {
60 mojo::MakeStrongBinding(base::MakeUnique<DialDeviceDescriptionParserImpl>(), 60 mojo::MakeStrongBinding(base::MakeUnique<DialDeviceDescriptionParserImpl>(),
61 std::move(request)); 61 std::move(request));
62 } 62 }
63 63
64 void DialDeviceDescriptionParserImpl::ParseDialDeviceDescription( 64 void DialDeviceDescriptionParserImpl::ParseDialDeviceDescription(
65 const std::string& device_description_xml_data, 65 const std::string& device_description_xml_data,
66 const ParseDialDeviceDescriptionCallback& callback) { 66 ParseDialDeviceDescriptionCallback callback) {
67 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
68 DCHECK(!callback.is_null()); 68 DCHECK(!callback.is_null());
69 69
70 chrome::mojom::DialDeviceDescriptionPtr device_description = 70 chrome::mojom::DialDeviceDescriptionPtr device_description =
71 Parse(device_description_xml_data); 71 Parse(device_description_xml_data);
72 callback.Run(std::move(device_description)); 72 std::move(callback).Run(std::move(device_description));
73 } 73 }
74 74
75 chrome::mojom::DialDeviceDescriptionPtr DialDeviceDescriptionParserImpl::Parse( 75 chrome::mojom::DialDeviceDescriptionPtr DialDeviceDescriptionParserImpl::Parse(
76 const std::string& xml) { 76 const std::string& xml) {
77 XmlReader xml_reader; 77 XmlReader xml_reader;
78 if (!xml_reader.Load(xml)) 78 if (!xml_reader.Load(xml))
79 return nullptr; 79 return nullptr;
80 80
81 chrome::mojom::DialDeviceDescriptionPtr out = 81 chrome::mojom::DialDeviceDescriptionPtr out =
82 chrome::mojom::DialDeviceDescription::New(); 82 chrome::mojom::DialDeviceDescription::New();
(...skipping 23 matching lines...) Expand all
106 ErrorType error = Validate(*out); 106 ErrorType error = Validate(*out);
107 if (error != ErrorType::NONE) { 107 if (error != ErrorType::NONE) {
108 DLOG(WARNING) << "Device description failed to validate: " << error; 108 DLOG(WARNING) << "Device description failed to validate: " << error;
109 return nullptr; 109 return nullptr;
110 } 110 }
111 111
112 return out; 112 return out;
113 } 113 }
114 114
115 } // namespace media_router 115 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/utility/media_router/dial_device_description_parser_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698