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

Side by Side Diff: chrome/browser/extensions/api/messaging/message_service.h

Issue 709933002: Add frameId to MessageSender (extension messaging API) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test that tests for a non-negative frameId Created 6 years, 1 month 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
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_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>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 struct MessageChannel; 68 struct MessageChannel;
69 69
70 // One side of the communication handled by extensions::MessageService. 70 // One side of the communication handled by extensions::MessageService.
71 class MessagePort { 71 class MessagePort {
72 public: 72 public:
73 virtual ~MessagePort() {} 73 virtual ~MessagePort() {}
74 // Notify the port that the channel has been opened. 74 // Notify the port that the channel has been opened.
75 virtual void DispatchOnConnect(int dest_port_id, 75 virtual void DispatchOnConnect(int dest_port_id,
76 const std::string& channel_name, 76 const std::string& channel_name,
77 const base::DictionaryValue& source_tab, 77 const base::DictionaryValue& source_tab,
78 int source_frame_id,
78 const std::string& source_extension_id, 79 const std::string& source_extension_id,
79 const std::string& target_extension_id, 80 const std::string& target_extension_id,
80 const GURL& source_url, 81 const GURL& source_url,
81 const std::string& tls_channel_id) {} 82 const std::string& tls_channel_id) {}
82 83
83 // Notify the port that the channel has been closed. If |error_message| is 84 // 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. 85 // non-empty, it indicates an error occurred while opening the connection.
85 virtual void DispatchOnDisconnect(int source_port_id, 86 virtual void DispatchOnDisconnect(int source_port_id,
86 const std::string& error_message) {} 87 const std::string& error_message) {}
87 88
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 static BrowserContextKeyedAPIFactory<MessageService>* GetFactoryInstance(); 126 static BrowserContextKeyedAPIFactory<MessageService>* GetFactoryInstance();
126 127
127 // Convenience method to get the MessageService for a browser context. 128 // Convenience method to get the MessageService for a browser context.
128 static MessageService* Get(content::BrowserContext* context); 129 static MessageService* Get(content::BrowserContext* context);
129 130
130 // Given an extension's ID, opens a channel between the given renderer "port" 131 // Given an extension's ID, opens a channel between the given renderer "port"
131 // and every listening context owned by that extension. |channel_name| is 132 // and every listening context owned by that extension. |channel_name| is
132 // an optional identifier for use by extension developers. 133 // an optional identifier for use by extension developers.
133 void OpenChannelToExtension( 134 void OpenChannelToExtension(
134 int source_process_id, int source_routing_id, int receiver_port_id, 135 int source_process_id, int source_routing_id, int receiver_port_id,
136 int source_frame_id,
135 const std::string& source_extension_id, 137 const std::string& source_extension_id,
136 const std::string& target_extension_id, 138 const std::string& target_extension_id,
137 const GURL& source_url, 139 const GURL& source_url,
138 const std::string& channel_name, 140 const std::string& channel_name,
139 bool include_tls_channel_id); 141 bool include_tls_channel_id);
140 142
141 // Same as above, but opens a channel to the tab with the given ID. Messages 143 // Same as above, but opens a channel to the tab with the given ID. Messages
142 // are restricted to that tab, so if there are multiple tabs in that process, 144 // are restricted to that tab, so if there are multiple tabs in that process,
143 // only the targeted tab will receive messages. 145 // only the targeted tab will receive messages.
144 void OpenChannelToTab( 146 void OpenChannelToTab(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 LazyBackgroundTaskQueue* lazy_background_task_queue_; 273 LazyBackgroundTaskQueue* lazy_background_task_queue_;
272 274
273 base::WeakPtrFactory<MessageService> weak_factory_; 275 base::WeakPtrFactory<MessageService> weak_factory_;
274 276
275 DISALLOW_COPY_AND_ASSIGN(MessageService); 277 DISALLOW_COPY_AND_ASSIGN(MessageService);
276 }; 278 };
277 279
278 } // namespace extensions 280 } // namespace extensions
279 281
280 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ 282 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698