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

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

Issue 1588533002: Never connect a port to the same frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also rename invocation of WillConnectToPort Created 4 years, 11 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // A messaging channel. Note that the opening port can be the same as the 56 // A messaging channel. Note that the opening port can be the same as the
57 // receiver, if an extension background page wants to talk to its tab (for 57 // receiver, if an extension background page wants to talk to its tab (for
58 // example). 58 // example).
59 struct MessageChannel; 59 struct MessageChannel;
60 60
61 // One side of the communication handled by extensions::MessageService. 61 // One side of the communication handled by extensions::MessageService.
62 class MessagePort { 62 class MessagePort {
63 public: 63 public:
64 virtual ~MessagePort() {} 64 virtual ~MessagePort() {}
65 65
66 // Called right before a channel is created for this MessagePort and |port|.
67 // This allows us to ensure that the ports have no RenderFrameHost instances
68 // in common.
69 virtual void RemoveCommonFrames(const MessagePort& port);
70
71 // Check whether the given RenderFrameHost is associated with this port.
72 virtual bool HasFrame(content::RenderFrameHost* rfh) const;
73
66 // Called right before a port is connected to a channel. If false, the port 74 // Called right before a port is connected to a channel. If false, the port
67 // is not used and the channel is closed. 75 // is not used and the channel is closed.
68 virtual bool IsValidPort() = 0; 76 virtual bool IsValidPort() = 0;
69 77
70 // Notify the port that the channel has been opened. 78 // Notify the port that the channel has been opened.
71 virtual void DispatchOnConnect(const std::string& channel_name, 79 virtual void DispatchOnConnect(const std::string& channel_name,
72 scoped_ptr<base::DictionaryValue> source_tab, 80 scoped_ptr<base::DictionaryValue> source_tab,
73 int source_frame_id, 81 int source_frame_id,
74 int guest_process_id, 82 int guest_process_id,
75 int guest_render_frame_routing_id, 83 int guest_render_frame_routing_id,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 LazyBackgroundTaskQueue* lazy_background_task_queue_; 314 LazyBackgroundTaskQueue* lazy_background_task_queue_;
307 315
308 base::WeakPtrFactory<MessageService> weak_factory_; 316 base::WeakPtrFactory<MessageService> weak_factory_;
309 317
310 DISALLOW_COPY_AND_ASSIGN(MessageService); 318 DISALLOW_COPY_AND_ASSIGN(MessageService);
311 }; 319 };
312 320
313 } // namespace extensions 321 } // namespace extensions
314 322
315 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ 323 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698