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

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

Issue 11636050: Eliminate ApiResourceEventNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/values.h"
13 #include "chrome/browser/usb/usb_device.h"
14 #include "googleurl/src/gurl.h"
15
16 class Profile;
17
18 namespace base {
19 class ListValue;
20 }
21
22 namespace extensions {
23 class EventRouter;
24
25 enum ApiResourceEventType {
26 };
27
28 extern const char kSrcIdKey[];
29
30 // ApiResourceEventNotifier knows how to send an event to a specific app's
31 // onEvent handler.
32 class ApiResourceEventNotifier
33 : public base::RefCountedThreadSafe<ApiResourceEventNotifier> {
34 public:
35 ApiResourceEventNotifier(EventRouter* router, Profile* profile,
36 const std::string& src_extension_id, int src_id,
37 const GURL& src_url);
38
39 static std::string ApiResourceEventTypeToString(
40 ApiResourceEventType event_type);
41
42 const std::string& src_extension_id() const { return src_extension_id_; }
43
44 private:
45 friend class base::RefCountedThreadSafe<ApiResourceEventNotifier>;
46 friend class MockApiResourceEventNotifier;
47
48 virtual ~ApiResourceEventNotifier();
49
50 void DispatchEvent(const std::string& event_name, DictionaryValue* args);
51 void DispatchEventOnUIThread(const std::string& event_name,
52 DictionaryValue* args);
53 DictionaryValue* CreateApiResourceEvent(ApiResourceEventType event_type);
54
55 EventRouter* router_;
56 Profile* profile_;
57 std::string src_extension_id_;
58 int src_id_;
59 GURL src_url_;
60
61 DISALLOW_COPY_AND_ASSIGN(ApiResourceEventNotifier);
62 };
63
64 } // namespace extensions
65
66 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/api_resource.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