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

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

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 #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
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/platform_file.h" 12 #include "base/platform_file.h"
13 #include "chrome/browser/extensions/api/api_resource.h" 13 #include "chrome/browser/extensions/api/api_resource.h"
14 #include "chrome/browser/extensions/api/api_resource_manager.h"
15 #include "content/public/browser/browser_thread.h"
14 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
15 17
18 using content::BrowserThread;
19
16 namespace extensions { 20 namespace extensions {
17 21
18 extern const char kSerialConnectionNotFoundError[]; 22 extern const char kSerialConnectionNotFoundError[];
19 23
20 class APIResourceEventNotifier; 24 class ApiResourceEventNotifier;
21 25
22 // Encapsulates an open serial port. Platform-specific implementations are in 26 // Encapsulates an open serial port. Platform-specific implementations are in
23 // _win and _posix versions of the the .cc file. 27 // _win and _posix versions of the the .cc file.
24 class SerialConnection : public APIResource { 28 class SerialConnection : public ApiResource {
25 public: 29 public:
26 SerialConnection(const std::string& port, 30 SerialConnection(const std::string& port,
27 int bitrate, 31 int bitrate,
28 APIResourceEventNotifier* event_notifier); 32 ApiResourceEventNotifier* event_notifier);
29 virtual ~SerialConnection(); 33 virtual ~SerialConnection();
30 34
31 virtual bool Open(); 35 virtual bool Open();
32 virtual void Close(); 36 virtual void Close();
33 virtual void Flush(); 37 virtual void Flush();
34 38
35 virtual int Read(uint8* byte); 39 virtual int Read(uint8* byte);
36 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count); 40 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count);
37 41
38 struct ControlSignals { 42 struct ControlSignals {
(...skipping 20 matching lines...) Expand all
59 63
60 private: 64 private:
61 std::string port_; 65 std::string port_;
62 int bitrate_; 66 int bitrate_;
63 base::PlatformFile file_; 67 base::PlatformFile file_;
64 }; 68 };
65 69
66 } // namespace extensions 70 } // namespace extensions
67 71
68 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ 72 #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