| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | 51 virtual ~APIResourceEventNotifier(); |
| 52 | 52 |
| 53 virtual void OnConnectComplete(int result_code); | 53 virtual void OnConnectComplete(int result_code); |
| 54 | 54 |
| 55 // Takes ownership of data. | 55 // Takes ownership of data. |
| 56 virtual void OnDataRead(int result_code, base::ListValue* data); | 56 virtual void OnDataRead(int result_code, |
| 57 base::ListValue* data, |
| 58 const std::string& address, |
| 59 int port); |
| 57 | 60 |
| 58 virtual void OnWriteComplete(int result_code); | 61 virtual void OnWriteComplete(int result_code); |
| 59 | 62 |
| 60 static std::string APIResourceEventTypeToString( | 63 static std::string APIResourceEventTypeToString( |
| 61 APIResourceEventType event_type); | 64 APIResourceEventType event_type); |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 void DispatchEvent(DictionaryValue* event); | 67 void DispatchEvent(DictionaryValue* event); |
| 65 void DispatchEventOnUIThread(DictionaryValue* event); | 68 void DispatchEventOnUIThread(DictionaryValue* event); |
| 66 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type); | 69 DictionaryValue* CreateAPIResourceEvent(APIResourceEventType event_type); |
| 67 | 70 |
| 68 void SendEventWithResultCode(APIResourceEventType event_type, | 71 void SendEventWithResultCode(APIResourceEventType event_type, |
| 69 int result_code); | 72 int result_code); |
| 70 | 73 |
| 71 ExtensionEventRouter* router_; | 74 ExtensionEventRouter* router_; |
| 72 Profile* profile_; | 75 Profile* profile_; |
| 73 std::string src_extension_id_; | 76 std::string src_extension_id_; |
| 74 int src_id_; | 77 int src_id_; |
| 75 GURL src_url_; | 78 GURL src_url_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier); | 80 DISALLOW_COPY_AND_ASSIGN(APIResourceEventNotifier); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace extensions | 83 } // namespace extensions |
| 81 | 84 |
| 82 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_API_API_RESOURCE_EVENT_NOTIFIER_H_ |
| OLD | NEW |