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

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

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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 extern const char kSerialConnectionNotFoundError[]; 22 extern const char kSerialConnectionNotFoundError[];
23 23
24 class ApiResourceEventNotifier; 24 class ApiResourceEventNotifier;
25 25
26 // Encapsulates an open serial port. Platform-specific implementations are in 26 // Encapsulates an open serial port. Platform-specific implementations are in
27 // _win and _posix versions of the the .cc file. 27 // _win and _posix versions of the the .cc file.
28 class SerialConnection : public ApiResource { 28 class SerialConnection : public ApiResource {
29 public: 29 public:
30 SerialConnection(const std::string& port, 30 SerialConnection(const std::string& port,
31 int bitrate, 31 int bitrate,
32 const std::string& owner_extension_id,
32 ApiResourceEventNotifier* event_notifier); 33 ApiResourceEventNotifier* event_notifier);
33 virtual ~SerialConnection(); 34 virtual ~SerialConnection();
34 35
35 virtual bool Open(); 36 virtual bool Open();
36 virtual void Close(); 37 virtual void Close();
37 virtual void Flush(); 38 virtual void Flush();
38 39
39 virtual int Read(scoped_refptr<net::IOBufferWithSize> io_buffer); 40 virtual int Read(scoped_refptr<net::IOBufferWithSize> io_buffer);
40 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count); 41 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count);
41 42
(...skipping 21 matching lines...) Expand all
63 64
64 private: 65 private:
65 std::string port_; 66 std::string port_;
66 int bitrate_; 67 int bitrate_;
67 base::PlatformFile file_; 68 base::PlatformFile file_;
68 }; 69 };
69 70
70 } // namespace extensions 71 } // namespace extensions
71 72
72 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ 73 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/serial/serial_apitest.cc ('k') | chrome/browser/extensions/api/serial/serial_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698