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

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

Issue 198163004: Revert 257524 "Move IsStringASCII/UTF8 to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 void SerialConnection::StartOpen() { 163 void SerialConnection::StartOpen() {
164 DCHECK(!open_complete_.is_null()); 164 DCHECK(!open_complete_.is_null());
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
166 DCHECK_EQ(file_, base::kInvalidPlatformFileValue); 166 DCHECK_EQ(file_, base::kInvalidPlatformFileValue);
167 base::PlatformFile file = base::kInvalidPlatformFileValue; 167 base::PlatformFile file = base::kInvalidPlatformFileValue;
168 // It's the responsibility of the API wrapper around SerialConnection to 168 // It's the responsibility of the API wrapper around SerialConnection to
169 // validate the supplied path against the set of valid port names, and 169 // validate the supplied path against the set of valid port names, and
170 // it is a reasonable assumption that serial port names are ASCII. 170 // it is a reasonable assumption that serial port names are ASCII.
171 DCHECK(base::IsStringASCII(port_)); 171 DCHECK(IsStringASCII(port_));
172 base::FilePath path( 172 base::FilePath path(
173 base::FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_))); 173 base::FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_)));
174 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | 174 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ |
175 base::PLATFORM_FILE_EXCLUSIVE_READ | base::PLATFORM_FILE_WRITE | 175 base::PLATFORM_FILE_EXCLUSIVE_READ | base::PLATFORM_FILE_WRITE |
176 base::PLATFORM_FILE_EXCLUSIVE_WRITE | base::PLATFORM_FILE_ASYNC | 176 base::PLATFORM_FILE_EXCLUSIVE_WRITE | base::PLATFORM_FILE_ASYNC |
177 base::PLATFORM_FILE_TERMINAL_DEVICE; 177 base::PLATFORM_FILE_TERMINAL_DEVICE;
178 file = base::CreatePlatformFile(path, flags, NULL, NULL); 178 file = base::CreatePlatformFile(path, flags, NULL, NULL);
179 BrowserThread::PostTask( 179 BrowserThread::PostTask(
180 BrowserThread::IO, 180 BrowserThread::IO,
181 FROM_HERE, 181 FROM_HERE,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 FROM_HERE, 253 FROM_HERE,
254 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()), 254 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()),
255 delay_); 255 delay_);
256 } 256 }
257 257
258 SerialConnection::TimeoutTask::~TimeoutTask() {} 258 SerialConnection::TimeoutTask::~TimeoutTask() {}
259 259
260 void SerialConnection::TimeoutTask::Run() const { closure_.Run(); } 260 void SerialConnection::TimeoutTask::Run() const { closure_.Run(); }
261 261
262 } // namespace extensions 262 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698