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

Unified Diff: content/public/browser/browser_message_filter.cc

Issue 142923005: Allow MessageFilters to restrict listening to specific message classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/browser/browser_message_filter.h ('k') | content/shell/browser/shell_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/browser_message_filter.cc
diff --git a/content/public/browser/browser_message_filter.cc b/content/public/browser/browser_message_filter.cc
index e72a484d9687cb8019d529494bc659573c451ace..72b4a1cfc3d83e5a2f509f6ea311c9b47c049215 100644
--- a/content/public/browser/browser_message_filter.cc
+++ b/content/public/browser/browser_message_filter.cc
@@ -76,6 +76,14 @@ class BrowserMessageFilter::Internal : public IPC::ChannelProxy::MessageFilter {
return true;
}
+ virtual bool GetSupportedMessageClasses(
+ std::vector<uint32>* supported_message_classes) const OVERRIDE {
+ supported_message_classes->assign(
+ filter_->message_classes_to_filter().begin(),
+ filter_->message_classes_to_filter().end());
+ return true;
+ }
+
// Dispatches a message to the derived class.
bool DispatchMessage(const IPC::Message& message) {
bool message_was_ok = true;
@@ -96,12 +104,28 @@ class BrowserMessageFilter::Internal : public IPC::ChannelProxy::MessageFilter {
DISALLOW_COPY_AND_ASSIGN(Internal);
};
-BrowserMessageFilter::BrowserMessageFilter()
- : internal_(NULL), channel_(NULL),
+BrowserMessageFilter::BrowserMessageFilter(uint32 message_class_to_filter)
+ : internal_(NULL),
+ channel_(NULL),
+#if defined(OS_WIN)
+ peer_handle_(base::kNullProcessHandle),
+#endif
+ peer_pid_(base::kNullProcessId),
+ message_classes_to_filter_(1, message_class_to_filter) {}
+
+BrowserMessageFilter::BrowserMessageFilter(
+ const uint32* message_classes_to_filter,
+ size_t num_message_classes_to_filter)
+ : internal_(NULL),
+ channel_(NULL),
#if defined(OS_WIN)
peer_handle_(base::kNullProcessHandle),
#endif
- peer_pid_(base::kNullProcessId) {
+ peer_pid_(base::kNullProcessId),
+ message_classes_to_filter_(
+ message_classes_to_filter,
+ message_classes_to_filter + num_message_classes_to_filter) {
+ DCHECK(num_message_classes_to_filter);
}
base::ProcessHandle BrowserMessageFilter::PeerHandle() {
« no previous file with comments | « content/public/browser/browser_message_filter.h ('k') | content/shell/browser/shell_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698