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

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

Issue 10919201: Make sure that a given app/extension requests only its own resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve tests; fix merge conflicts. Created 8 years, 3 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 const std::string& owner_extension_id,
18 ApiResourceEventNotifier* event_notifier) 19 ApiResourceEventNotifier* event_notifier)
19 : ApiResource(event_notifier), 20 : ApiResource(owner_extension_id, event_notifier),
20 port_(port), 21 port_(port),
21 bitrate_(bitrate), 22 bitrate_(bitrate),
22 file_(base::kInvalidPlatformFileValue) { 23 file_(base::kInvalidPlatformFileValue) {
23 CHECK(bitrate >= 0); 24 CHECK(bitrate >= 0);
24 } 25 }
25 26
26 SerialConnection::~SerialConnection() { 27 SerialConnection::~SerialConnection() {
27 Close(); 28 Close();
28 } 29 }
29 30
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DCHECK(byte_count >= 0); 68 DCHECK(byte_count >= 0);
68 return base::WritePlatformFileAtCurrentPos(file_, 69 return base::WritePlatformFileAtCurrentPos(file_,
69 io_buffer->data(), byte_count); 70 io_buffer->data(), byte_count);
70 } 71 }
71 72
72 void SerialConnection::Flush() { 73 void SerialConnection::Flush() {
73 base::FlushPlatformFile(file_); 74 base::FlushPlatformFile(file_);
74 } 75 }
75 76
76 } // namespace extensions 77 } // 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