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

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

Issue 10777003: Refactor APIResourceController to ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge/antony/fix build. Created 8 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/file_path.h" 9 #include "base/file_path.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 const char kSerialConnectionNotFoundError[] = "Serial connection not found"; 14 const char kSerialConnectionNotFoundError[] = "Serial connection not found";
15 15
16 SerialConnection::SerialConnection(const std::string& port, 16 SerialConnection::SerialConnection(const std::string& port,
17 int bitrate, 17 int bitrate,
18 APIResourceEventNotifier* event_notifier) 18 ApiResourceEventNotifier* event_notifier)
19 : APIResource(APIResource::SerialConnectionResource, event_notifier), 19 : ApiResource(event_notifier),
20 port_(port), 20 port_(port),
21 bitrate_(bitrate), 21 bitrate_(bitrate),
22 file_(base::kInvalidPlatformFileValue) { 22 file_(base::kInvalidPlatformFileValue) {
23 CHECK(bitrate >= 0); 23 CHECK(bitrate >= 0);
24 } 24 }
25 25
26 SerialConnection::~SerialConnection() { 26 SerialConnection::~SerialConnection() {
27 Close(); 27 Close();
28 } 28 }
29 29
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 DCHECK(byte_count >= 0); 66 DCHECK(byte_count >= 0);
67 return base::WritePlatformFileAtCurrentPos(file_, 67 return base::WritePlatformFileAtCurrentPos(file_,
68 io_buffer->data(), byte_count); 68 io_buffer->data(), byte_count);
69 } 69 }
70 70
71 void SerialConnection::Flush() { 71 void SerialConnection::Flush() {
72 base::FlushPlatformFile(file_); 72 base::FlushPlatformFile(file_);
73 } 73 }
74 74
75 } // namespace extensions 75 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/serial/serial_connection.h ('k') | chrome/browser/extensions/api/socket/socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698