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

Side by Side Diff: chrome/browser/extensions/api/serial/serial_connection.cc

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/browser/extensions/api/serial/serial_connection.h" 5 #include "chrome/browser/extensions/api/serial/serial_connection.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return GetPortInfo(info); 157 return GetPortInfo(info);
158 } 158 }
159 159
160 void SerialConnection::StartOpen() { 160 void SerialConnection::StartOpen() {
161 DCHECK(!open_complete_.is_null()); 161 DCHECK(!open_complete_.is_null());
162 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 162 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
163 DCHECK(!file_.IsValid()); 163 DCHECK(!file_.IsValid());
164 // It's the responsibility of the API wrapper around SerialConnection to 164 // It's the responsibility of the API wrapper around SerialConnection to
165 // validate the supplied path against the set of valid port names, and 165 // validate the supplied path against the set of valid port names, and
166 // it is a reasonable assumption that serial port names are ASCII. 166 // it is a reasonable assumption that serial port names are ASCII.
167 DCHECK(IsStringASCII(port_)); 167 DCHECK(base::IsStringASCII(port_));
168 base::FilePath path( 168 base::FilePath path(
169 base::FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_))); 169 base::FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_)));
170 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | 170 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ |
171 base::File::FLAG_EXCLUSIVE_READ | base::File::FLAG_WRITE | 171 base::File::FLAG_EXCLUSIVE_READ | base::File::FLAG_WRITE |
172 base::File::FLAG_EXCLUSIVE_WRITE | base::File::FLAG_ASYNC | 172 base::File::FLAG_EXCLUSIVE_WRITE | base::File::FLAG_ASYNC |
173 base::File::FLAG_TERMINAL_DEVICE; 173 base::File::FLAG_TERMINAL_DEVICE;
174 base::File file(path, flags); 174 base::File file(path, flags);
175 BrowserThread::PostTask( 175 BrowserThread::PostTask(
176 BrowserThread::IO, 176 BrowserThread::IO,
177 FROM_HERE, 177 FROM_HERE,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 FROM_HERE, 250 FROM_HERE,
251 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()), 251 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()),
252 delay_); 252 delay_);
253 } 253 }
254 254
255 SerialConnection::TimeoutTask::~TimeoutTask() {} 255 SerialConnection::TimeoutTask::~TimeoutTask() {}
256 256
257 void SerialConnection::TimeoutTask::Run() const { closure_.Run(); } 257 void SerialConnection::TimeoutTask::Run() const { closure_.Run(); }
258 258
259 } // namespace extensions 259 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api_helpers.cc ('k') | chrome/browser/extensions/api/web_request/web_request_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698