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

Side by Side Diff: device/serial/serial_service_impl.cc

Issue 889283002: Remove Client= from device/serial/data_stream.mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: This time without racing message pipes Created 5 years, 10 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 | « device/serial/serial_service_impl.h ('k') | device/serial/serial_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/serial/serial_service_impl.h" 5 #include "device/serial/serial_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "device/serial/serial_io_handler.h" 9 #include "device/serial/serial_io_handler.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void SerialServiceImpl::GetDevices( 54 void SerialServiceImpl::GetDevices(
55 const mojo::Callback<void(mojo::Array<serial::DeviceInfoPtr>)>& callback) { 55 const mojo::Callback<void(mojo::Array<serial::DeviceInfoPtr>)>& callback) {
56 callback.Run(GetDeviceEnumerator()->GetDevices()); 56 callback.Run(GetDeviceEnumerator()->GetDevices());
57 } 57 }
58 58
59 void SerialServiceImpl::Connect( 59 void SerialServiceImpl::Connect(
60 const mojo::String& path, 60 const mojo::String& path,
61 serial::ConnectionOptionsPtr options, 61 serial::ConnectionOptionsPtr options,
62 mojo::InterfaceRequest<serial::Connection> connection_request, 62 mojo::InterfaceRequest<serial::Connection> connection_request,
63 mojo::InterfaceRequest<serial::DataSink> sink, 63 mojo::InterfaceRequest<serial::DataSink> sink,
64 mojo::InterfaceRequest<serial::DataSource> source) { 64 mojo::InterfaceRequest<serial::DataSource> source,
65 mojo::InterfacePtr<serial::DataSourceClient> source_client) {
65 if (!IsValidPath(path)) 66 if (!IsValidPath(path))
66 return; 67 return;
67 connection_factory_->CreateConnection(path, 68 connection_factory_->CreateConnection(path, options.Pass(),
68 options.Pass(), 69 connection_request.Pass(), sink.Pass(),
69 connection_request.Pass(), 70 source.Pass(), source_client.Pass());
70 sink.Pass(),
71 source.Pass());
72 } 71 }
73 72
74 SerialDeviceEnumerator* SerialServiceImpl::GetDeviceEnumerator() { 73 SerialDeviceEnumerator* SerialServiceImpl::GetDeviceEnumerator() {
75 if (!device_enumerator_) 74 if (!device_enumerator_)
76 device_enumerator_ = SerialDeviceEnumerator::Create(); 75 device_enumerator_ = SerialDeviceEnumerator::Create();
77 return device_enumerator_.get(); 76 return device_enumerator_.get();
78 } 77 }
79 78
80 bool SerialServiceImpl::IsValidPath(const mojo::String& path) { 79 bool SerialServiceImpl::IsValidPath(const mojo::String& path) {
81 mojo::Array<serial::DeviceInfoPtr> devices( 80 mojo::Array<serial::DeviceInfoPtr> devices(
82 GetDeviceEnumerator()->GetDevices()); 81 GetDeviceEnumerator()->GetDevices());
83 for (size_t i = 0; i < devices.size(); i++) { 82 for (size_t i = 0; i < devices.size(); i++) {
84 if (path == devices[i]->path) 83 if (path == devices[i]->path)
85 return true; 84 return true;
86 } 85 }
87 return false; 86 return false;
88 } 87 }
89 88
90 } // namespace device 89 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_service_impl.h ('k') | device/serial/serial_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698