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

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

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 8 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_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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 // APIResourceEventNotifier knows how to send an event to a specific app's 42 // APIResourceEventNotifier knows how to send an event to a specific app's
43 // onEvent handler. It handles all platform-API events. 43 // onEvent handler. It handles all platform-API events.
44 class APIResourceEventNotifier 44 class APIResourceEventNotifier
45 : public base::RefCountedThreadSafe<APIResourceEventNotifier> { 45 : public base::RefCountedThreadSafe<APIResourceEventNotifier> {
46 public: 46 public:
47 APIResourceEventNotifier(ExtensionEventRouter* router, 47 APIResourceEventNotifier(ExtensionEventRouter* router,
48 Profile* profile, 48 Profile* profile,
49 const std::string& src_extension_id, int src_id, 49 const std::string& src_extension_id, int src_id,
50 const GURL& src_url); 50 const GURL& src_url);
51 virtual ~APIResourceEventNotifier();
52 51
53 virtual void OnConnectComplete(int result_code); 52 virtual void OnConnectComplete(int result_code);
54 53
55 // Takes ownership of data. 54 // Takes ownership of data.
56 virtual void OnDataRead(int result_code, 55 virtual void OnDataRead(int result_code,
57 base::ListValue* data, 56 base::ListValue* data,
58 const std::string& address, 57 const std::string& address,
59 int port); 58 int port);
60 59
61 virtual void OnWriteComplete(int result_code); 60 virtual void OnWriteComplete(int result_code);
62 61
63 static std::string APIResourceEventTypeToString( 62 static std::string APIResourceEventTypeToString(
64 APIResourceEventType event_type); 63 APIResourceEventType event_type);
65 64
66 private: 65 private:
66 friend class base::RefCountedThreadSafe<APIResourceEventNotifier>;
67 friend class MockAPIResourceEventNotifier;
68
69 virtual ~APIResourceEventNotifier();
70
67 void DispatchEvent(DictionaryValue* event); 71 void DispatchEvent(DictionaryValue* event);
68 void DispatchEventOnUIThread(DictionaryValue* event); 72 void DispatchEventOnUIThread(DictionaryValue* event);
69 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type); 73 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type);
70 74
71 void SendEventWithResultCode(APIResourceEventType event_type, 75 void SendEventWithResultCode(APIResourceEventType event_type,
72 int result_code); 76 int result_code);
73 77
74 ExtensionEventRouter* router_; 78 ExtensionEventRouter* router_;
75 Profile* profile_; 79 Profile* profile_;
76 std::string src_extension_id_; 80 std::string src_extension_id_;
77 int src_id_; 81 int src_id_;
78 GURL src_url_; 82 GURL src_url_;
79 83
80 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier); 84 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier);
81 }; 85 };
82 86
83 } // namespace extensions 87 } // namespace extensions
84 88
85 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ 89 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/api_function.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