| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // IPC::Message::Sender implementation. Can be called on any thread. Can't | 31 // IPC::Message::Sender implementation. Can be called on any thread. Can't |
| 32 // send sync messages (since we don't want to block the browser on any other | 32 // send sync messages (since we don't want to block the browser on any other |
| 33 // process). | 33 // process). |
| 34 virtual bool Send(IPC::Message* message); | 34 virtual bool Send(IPC::Message* message); |
| 35 | 35 |
| 36 // If you want the given message to be dispatched to your OnMessageReceived on | 36 // If you want the given message to be dispatched to your OnMessageReceived on |
| 37 // a different thread, change |thread| to the id of the target thread. | 37 // a different thread, change |thread| to the id of the target thread. |
| 38 // If you don't handle this message, or want to keep it on the IO thread, do | 38 // If you don't handle this message, or want to keep it on the IO thread, do |
| 39 // nothing. | 39 // nothing. |
| 40 virtual void OverrideThreadForMessage(const IPC::Message& message, | 40 virtual void OverrideThreadForMessage(const IPC::Message& message, |
| 41 BrowserThread::ID* thread); | 41 content::BrowserThread::ID* thread); |
| 42 | 42 |
| 43 // Override this to receive messages. | 43 // Override this to receive messages. |
| 44 // Your function will normally be called on the IO thread. However, if your | 44 // Your function will normally be called on the IO thread. However, if your |
| 45 // OverrideThreadForMessage modifies the thread used to dispatch the message, | 45 // OverrideThreadForMessage modifies the thread used to dispatch the message, |
| 46 // your function will be called on the requested thread. | 46 // your function will be called on the requested thread. |
| 47 virtual bool OnMessageReceived(const IPC::Message& message, | 47 virtual bool OnMessageReceived(const IPC::Message& message, |
| 48 bool* message_was_ok) = 0; | 48 bool* message_was_ok) = 0; |
| 49 | 49 |
| 50 // Can be called on any thread, after OnChannelConnected is called. | 50 // Can be called on any thread, after OnChannelConnected is called. |
| 51 base::ProcessHandle peer_handle() { return peer_handle_; } | 51 base::ProcessHandle peer_handle() { return peer_handle_; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 // Dispatches a message to the derived class. | 64 // Dispatches a message to the derived class. |
| 65 bool DispatchMessage(const IPC::Message& message); | 65 bool DispatchMessage(const IPC::Message& message); |
| 66 | 66 |
| 67 IPC::Channel* channel_; | 67 IPC::Channel* channel_; |
| 68 base::ProcessHandle peer_handle_; | 68 base::ProcessHandle peer_handle_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ | 71 #endif // CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ |
| OLD | NEW |