Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / public / browser / message_port_delegate.h
blobbbe6326fecc4d9b891cc5efe1575ca398a76d0ed
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "content/common/content_export.h"
13 // Windows headers will redefine SendMessage.
14 #ifdef SendMessage
15 #undef SendMessage
16 #endif
18 namespace content {
19 struct MessagePortMessage;
20 struct TransferredMessagePort;
22 // Delegate used by MessagePortService to send messages to message ports to the
23 // correct renderer. Delegates are responsible for managing their own lifetime,
24 // and should call MessagePortService::OnMessagePortDelegateClosing if they are
25 // destroyed while there are still message ports associated with them.
26 class CONTENT_EXPORT MessagePortDelegate {
27 public:
28 // Sends a message to the given route. Implementations are responsible for
29 // updating MessagePortService with new routes for the sent message ports.
30 virtual void SendMessage(
31 int route_id,
32 const MessagePortMessage& message,
33 const std::vector<TransferredMessagePort>& sent_message_ports) = 0;
35 // Called when MessagePortService tried to send a message to a port, but
36 // instead added it to its queue because the port is currently configured to
37 // hold all its messages.
38 virtual void MessageWasHeld(int route_id) {}
40 // Requests messages to the given route to be queued.
41 virtual void SendMessagesAreQueued(int route_id) = 0;
43 protected:
44 virtual ~MessagePortDelegate() {}
47 } // namespace content
49 #endif // CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_