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

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

Issue 646053002: Implement permission_broker for serial devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment. Created 6 years, 2 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
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 <windows.h> 5 #include <windows.h>
6 6
7 #include "device/serial/serial_io_handler_win.h" 7 #include "device/serial/serial_io_handler_win.h"
8 8
9 namespace device { 9 namespace device {
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 case ONESTOPBIT: 127 case ONESTOPBIT:
128 default: 128 default:
129 return serial::STOP_BITS_ONE; 129 return serial::STOP_BITS_ONE;
130 } 130 }
131 } 131 }
132 132
133 } // namespace 133 } // namespace
134 134
135 // static 135 // static
136 scoped_refptr<SerialIoHandler> SerialIoHandler::Create( 136 scoped_refptr<SerialIoHandler> SerialIoHandler::Create(
137 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop) { 137 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop,
138 return new SerialIoHandlerWin(file_thread_message_loop); 138 scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop) {
139 return new SerialIoHandlerWin(file_thread_message_loop,
140 ui_thread_message_loop);
139 } 141 }
140 142
141 bool SerialIoHandlerWin::PostOpen() { 143 bool SerialIoHandlerWin::PostOpen() {
142 DCHECK(!comm_context_); 144 DCHECK(!comm_context_);
143 DCHECK(!read_context_); 145 DCHECK(!read_context_);
144 DCHECK(!write_context_); 146 DCHECK(!write_context_);
145 147
146 base::MessageLoopForIO::current()->RegisterIOHandler(file().GetPlatformFile(), 148 base::MessageLoopForIO::current()->RegisterIOHandler(file().GetPlatformFile(),
147 this); 149 this);
148 150
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { 378 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) {
377 // For COM numbers less than 9, CreateFile is called with a string such as 379 // For COM numbers less than 9, CreateFile is called with a string such as
378 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. 380 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added.
379 if (port_name.length() > std::string("COM9").length()) 381 if (port_name.length() > std::string("COM9").length())
380 return std::string("\\\\.\\").append(port_name); 382 return std::string("\\\\.\\").append(port_name);
381 383
382 return port_name; 384 return port_name;
383 } 385 }
384 386
385 } // namespace device 387 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698