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_MESSAGING_MESSAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/values.h" |
16 #include "chrome/browser/extensions/api/messaging/message_property_provider.h" | 17 #include "chrome/browser/extensions/api/messaging/message_property_provider.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "extensions/browser/api/messaging/native_message_host.h" | 20 #include "extensions/browser/api/messaging/native_message_host.h" |
20 #include "extensions/browser/browser_context_keyed_api_factory.h" | 21 #include "extensions/browser/browser_context_keyed_api_factory.h" |
21 #include "extensions/common/api/messaging/message.h" | 22 #include "extensions/common/api/messaging/message.h" |
22 | 23 |
23 class GURL; | 24 class GURL; |
24 class Profile; | 25 class Profile; |
25 | 26 |
26 namespace base { | |
27 class DictionaryValue; | |
28 } | |
29 | |
30 namespace content { | 27 namespace content { |
31 class BrowserContext; | 28 class BrowserContext; |
32 class RenderProcessHost; | 29 class RenderProcessHost; |
33 class WebContents; | 30 class WebContents; |
34 } | 31 } |
35 | 32 |
36 namespace extensions { | 33 namespace extensions { |
37 class Extension; | 34 class Extension; |
38 class ExtensionHost; | 35 class ExtensionHost; |
39 class LazyBackgroundTaskQueue; | 36 class LazyBackgroundTaskQueue; |
(...skipping 27 matching lines...) Expand all Loading... |
67 // example). | 64 // example). |
68 struct MessageChannel; | 65 struct MessageChannel; |
69 | 66 |
70 // One side of the communication handled by extensions::MessageService. | 67 // One side of the communication handled by extensions::MessageService. |
71 class MessagePort { | 68 class MessagePort { |
72 public: | 69 public: |
73 virtual ~MessagePort() {} | 70 virtual ~MessagePort() {} |
74 // Notify the port that the channel has been opened. | 71 // Notify the port that the channel has been opened. |
75 virtual void DispatchOnConnect(int dest_port_id, | 72 virtual void DispatchOnConnect(int dest_port_id, |
76 const std::string& channel_name, | 73 const std::string& channel_name, |
77 const base::DictionaryValue& source_tab, | 74 scoped_ptr<base::DictionaryValue> source_tab, |
| 75 int source_frame_id, |
78 const std::string& source_extension_id, | 76 const std::string& source_extension_id, |
79 const std::string& target_extension_id, | 77 const std::string& target_extension_id, |
80 const GURL& source_url, | 78 const GURL& source_url, |
81 const std::string& tls_channel_id) {} | 79 const std::string& tls_channel_id) {} |
82 | 80 |
83 // Notify the port that the channel has been closed. If |error_message| is | 81 // Notify the port that the channel has been closed. If |error_message| is |
84 // non-empty, it indicates an error occurred while opening the connection. | 82 // non-empty, it indicates an error occurred while opening the connection. |
85 virtual void DispatchOnDisconnect(int source_port_id, | 83 virtual void DispatchOnDisconnect(int source_port_id, |
86 const std::string& error_message) {} | 84 const std::string& error_message) {} |
87 | 85 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 LazyBackgroundTaskQueue* lazy_background_task_queue_; | 269 LazyBackgroundTaskQueue* lazy_background_task_queue_; |
272 | 270 |
273 base::WeakPtrFactory<MessageService> weak_factory_; | 271 base::WeakPtrFactory<MessageService> weak_factory_; |
274 | 272 |
275 DISALLOW_COPY_AND_ASSIGN(MessageService); | 273 DISALLOW_COPY_AND_ASSIGN(MessageService); |
276 }; | 274 }; |
277 | 275 |
278 } // namespace extensions | 276 } // namespace extensions |
279 | 277 |
280 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ | 278 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
OLD | NEW |