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

Side by Side Diff: chrome/browser/extensions/api/api_resource_event_notifier.h

Issue 10696208: Move ExtensionEventRouter and related into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed bug + latest master 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
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_API_RESOURCE_EVENT_NOTIFIER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/usb/usb_device.h" 13 #include "chrome/browser/usb/usb_device.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 15
16 class ExtensionEventRouter;
17 class Profile; 16 class Profile;
18 17
19 namespace base { 18 namespace base {
20 class ListValue; 19 class ListValue;
21 } 20 }
22 21
23 namespace extensions { 22 namespace extensions {
23 class EventRouter;
24 24
25 enum ApiResourceEventType { 25 enum ApiResourceEventType {
26 API_RESOURCE_EVENT_CONNECT_COMPLETE, 26 API_RESOURCE_EVENT_CONNECT_COMPLETE,
27 API_RESOURCE_EVENT_DATA_READ, 27 API_RESOURCE_EVENT_DATA_READ,
28 API_RESOURCE_EVENT_WRITE_COMPLETE, 28 API_RESOURCE_EVENT_WRITE_COMPLETE,
29 API_RESOURCE_EVENT_TRANSFER_COMPLETE, 29 API_RESOURCE_EVENT_TRANSFER_COMPLETE,
30 }; 30 };
31 31
32 extern const char kSrcIdKey[]; 32 extern const char kSrcIdKey[];
33 33
34 // ApiResourceEventNotifier knows how to send an event to a specific app's 34 // ApiResourceEventNotifier knows how to send an event to a specific app's
35 // onEvent handler. 35 // onEvent handler.
36 class ApiResourceEventNotifier 36 class ApiResourceEventNotifier
37 : public base::RefCountedThreadSafe<ApiResourceEventNotifier> { 37 : public base::RefCountedThreadSafe<ApiResourceEventNotifier> {
38 public: 38 public:
39 ApiResourceEventNotifier(ExtensionEventRouter* router, 39 ApiResourceEventNotifier(EventRouter* router,
40 Profile* profile, 40 Profile* profile,
41 const std::string& src_extension_id, int src_id, 41 const std::string& src_extension_id, int src_id,
42 const GURL& src_url); 42 const GURL& src_url);
43 43
44 virtual void OnConnectComplete(int result_code); 44 virtual void OnConnectComplete(int result_code);
45 45
46 // Takes ownership of data. 46 // Takes ownership of data.
47 virtual void OnDataRead(int result_code, 47 virtual void OnDataRead(int result_code,
48 base::ListValue* data, 48 base::ListValue* data,
49 const std::string& address, 49 const std::string& address,
(...skipping 16 matching lines...) Expand all
66 66
67 void DispatchEvent(const std::string &extension, DictionaryValue* event); 67 void DispatchEvent(const std::string &extension, DictionaryValue* event);
68 void DispatchEventOnUIThread(const std::string& extension, 68 void DispatchEventOnUIThread(const std::string& extension,
69 DictionaryValue* event); 69 DictionaryValue* event);
70 DictionaryValue* CreateApiResourceEvent(ApiResourceEventType event_type); 70 DictionaryValue* CreateApiResourceEvent(ApiResourceEventType event_type);
71 71
72 void SendEventWithResultCode(const std::string& extension, 72 void SendEventWithResultCode(const std::string& extension,
73 ApiResourceEventType event_type, 73 ApiResourceEventType event_type,
74 int result_code); 74 int result_code);
75 75
76 ExtensionEventRouter* router_; 76 EventRouter* router_;
77 Profile* profile_; 77 Profile* profile_;
78 std::string src_extension_id_; 78 std::string src_extension_id_;
79 int src_id_; 79 int src_id_;
80 GURL src_url_; 80 GURL src_url_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(ApiResourceEventNotifier); 82 DISALLOW_COPY_AND_ASSIGN(ApiResourceEventNotifier);
83 }; 83 };
84 84
85 } // namespace extensions 85 } // namespace extensions
86 86
87 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ 87 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/alarms/alarm_manager.cc ('k') | chrome/browser/extensions/api/api_resource_event_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698