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

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

Issue 182213005: Move api_resource{,manager} out of src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_EVENT_DISPATCHER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_
7 7
8 #include "chrome/browser/extensions/api/api_resource_manager.h"
9 #include "chrome/common/extensions/api/serial.h" 8 #include "chrome/common/extensions/api/serial.h"
9 #include "extensions/browser/api/api_resource_manager.h"
10 10
11 class Profile; 11 class Profile;
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 struct Event; 15 struct Event;
16 class SerialConnection; 16 class SerialConnection;
17 17
18 namespace api { 18 namespace api {
19 19
(...skipping 10 matching lines...) Expand all
30 30
31 // BrowserContextKeyedAPI implementation. 31 // BrowserContextKeyedAPI implementation.
32 static BrowserContextKeyedAPIFactory<SerialEventDispatcher>* 32 static BrowserContextKeyedAPIFactory<SerialEventDispatcher>*
33 GetFactoryInstance(); 33 GetFactoryInstance();
34 34
35 private: 35 private:
36 typedef ApiResourceManager<SerialConnection>::ApiResourceData ConnectionData; 36 typedef ApiResourceManager<SerialConnection>::ApiResourceData ConnectionData;
37 friend class BrowserContextKeyedAPIFactory<SerialEventDispatcher>; 37 friend class BrowserContextKeyedAPIFactory<SerialEventDispatcher>;
38 38
39 // BrowserContextKeyedAPI implementation. 39 // BrowserContextKeyedAPI implementation.
40 static const char *service_name() { 40 static const char* service_name() { return "SerialEventDispatcher"; }
41 return "SerialEventDispatcher";
42 }
43 static const bool kServiceHasOwnInstanceInIncognito = true; 41 static const bool kServiceHasOwnInstanceInIncognito = true;
44 static const bool kServiceIsNULLWhileTesting = true; 42 static const bool kServiceIsNULLWhileTesting = true;
45 43
46 struct ReceiveParams { 44 struct ReceiveParams {
47 ReceiveParams(); 45 ReceiveParams();
48 ~ReceiveParams(); 46 ~ReceiveParams();
49 47
50 content::BrowserThread::ID thread_id; 48 content::BrowserThread::ID thread_id;
51 void* profile_id; 49 void* profile_id;
52 std::string extension_id; 50 std::string extension_id;
53 scoped_refptr<ConnectionData> connections; 51 scoped_refptr<ConnectionData> connections;
54 int connection_id; 52 int connection_id;
55 }; 53 };
56 54
57 static void StartReceive(const ReceiveParams& params); 55 static void StartReceive(const ReceiveParams& params);
58 56
59 static void ReceiveCallback(const ReceiveParams& params, 57 static void ReceiveCallback(const ReceiveParams& params,
60 const std::string& data, 58 const std::string& data,
61 serial::ReceiveError error); 59 serial::ReceiveError error);
62 60
63 static void PostEvent(const ReceiveParams& params, 61 static void PostEvent(const ReceiveParams& params,
64 scoped_ptr<extensions::Event> event); 62 scoped_ptr<extensions::Event> event);
65 63
66 static void DispatchEvent(void *profile_id, 64 static void DispatchEvent(void* profile_id,
67 const std::string& extension_id, 65 const std::string& extension_id,
68 scoped_ptr<extensions::Event> event); 66 scoped_ptr<extensions::Event> event);
69 67
70 content::BrowserThread::ID thread_id_; 68 content::BrowserThread::ID thread_id_;
71 Profile* const profile_; 69 Profile* const profile_;
72 scoped_refptr<ConnectionData> connections_; 70 scoped_refptr<ConnectionData> connections_;
73 }; 71 };
74 72
75 } // namespace api 73 } // namespace api
76 74
77 } // namespace extensions 75 } // namespace extensions
78 76
79 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_ 77 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/serial/serial_connection.cc ('k') | chrome/browser/extensions/api/socket/socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698