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

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: Implementations 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, base::ListValue* data); 55 virtual void OnDataRead(int result_code, base::ListValue* data);
57 56
58 virtual void OnWriteComplete(int result_code); 57 virtual void OnWriteComplete(int result_code);
59 58
60 static std::string APIResourceEventTypeToString( 59 static std::string APIResourceEventTypeToString(
61 APIResourceEventType event_type); 60 APIResourceEventType event_type);
62 61
63 private: 62 private:
63 friend class base::RefCountedThreadSafe<APIResourceEventNotifier>;
64 friend class MockAPIResourceEventNotifier;
65
66 virtual ~APIResourceEventNotifier();
67
64 void DispatchEvent(DictionaryValue* event); 68 void DispatchEvent(DictionaryValue* event);
65 void DispatchEventOnUIThread(DictionaryValue* event); 69 void DispatchEventOnUIThread(DictionaryValue* event);
66 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type); 70 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type);
67 71
68 void SendEventWithResultCode(APIResourceEventType event_type, 72 void SendEventWithResultCode(APIResourceEventType event_type,
69 int result_code); 73 int result_code);
70 74
71 ExtensionEventRouter* router_; 75 ExtensionEventRouter* router_;
72 Profile* profile_; 76 Profile* profile_;
73 std::string src_extension_id_; 77 std::string src_extension_id_;
74 int src_id_; 78 int src_id_;
75 GURL src_url_; 79 GURL src_url_;
76 80
77 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier); 81 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier);
78 }; 82 };
79 83
80 } // namespace extensions 84 } // namespace extensions
81 85
82 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ 86 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698