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

Side by Side Diff: content/browser/renderer_host/websocket_dispatcher_host.cc

Issue 165333004: Revert "Allow MessageFilters to restrict listening to specific message classes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/renderer_host/websocket_dispatcher_host.h" 5 #include "content/browser/renderer_host/websocket_dispatcher_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "content/browser/renderer_host/websocket_host.h" 12 #include "content/browser/renderer_host/websocket_host.h"
13 #include "content/common/websocket_messages.h" 13 #include "content/common/websocket_messages.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 namespace { 17 namespace {
18 18
19 // Many methods defined in this file return a WebSocketHostState enum 19 // Many methods defined in this file return a WebSocketHostState enum
20 // value. Make WebSocketHostState visible at file scope so it doesn't have to be 20 // value. Make WebSocketHostState visible at file scope so it doesn't have to be
21 // fully-qualified every time. 21 // fully-qualified every time.
22 typedef WebSocketDispatcherHost::WebSocketHostState WebSocketHostState; 22 typedef WebSocketDispatcherHost::WebSocketHostState WebSocketHostState;
23 23
24 } // namespace 24 } // namespace
25 25
26 WebSocketDispatcherHost::WebSocketDispatcherHost( 26 WebSocketDispatcherHost::WebSocketDispatcherHost(
27 const GetRequestContextCallback& get_context_callback) 27 const GetRequestContextCallback& get_context_callback)
28 : BrowserMessageFilter(WebSocketMsgStart), 28 : get_context_callback_(get_context_callback),
29 get_context_callback_(get_context_callback),
30 websocket_host_factory_( 29 websocket_host_factory_(
31 base::Bind(&WebSocketDispatcherHost::CreateWebSocketHost, 30 base::Bind(&WebSocketDispatcherHost::CreateWebSocketHost,
32 base::Unretained(this))) {} 31 base::Unretained(this))) {}
33 32
34 WebSocketDispatcherHost::WebSocketDispatcherHost( 33 WebSocketDispatcherHost::WebSocketDispatcherHost(
35 const GetRequestContextCallback& get_context_callback, 34 const GetRequestContextCallback& get_context_callback,
36 const WebSocketHostFactory& websocket_host_factory) 35 const WebSocketHostFactory& websocket_host_factory)
37 : BrowserMessageFilter(WebSocketMsgStart), 36 : get_context_callback_(get_context_callback),
38 get_context_callback_(get_context_callback),
39 websocket_host_factory_(websocket_host_factory) {} 37 websocket_host_factory_(websocket_host_factory) {}
40 38
41 WebSocketHost* WebSocketDispatcherHost::CreateWebSocketHost(int routing_id) { 39 WebSocketHost* WebSocketDispatcherHost::CreateWebSocketHost(int routing_id) {
42 return new WebSocketHost(routing_id, this, get_context_callback_.Run()); 40 return new WebSocketHost(routing_id, this, get_context_callback_.Run());
43 } 41 }
44 42
45 bool WebSocketDispatcherHost::OnMessageReceived(const IPC::Message& message, 43 bool WebSocketDispatcherHost::OnMessageReceived(const IPC::Message& message,
46 bool* message_was_ok) { 44 bool* message_was_ok) {
47 switch (message.type()) { 45 switch (message.type()) {
48 case WebSocketHostMsg_AddChannelRequest::ID: 46 case WebSocketHostMsg_AddChannelRequest::ID:
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 169 }
172 170
173 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) { 171 void WebSocketDispatcherHost::DeleteWebSocketHost(int routing_id) {
174 WebSocketHostTable::iterator it = hosts_.find(routing_id); 172 WebSocketHostTable::iterator it = hosts_.find(routing_id);
175 DCHECK(it != hosts_.end()); 173 DCHECK(it != hosts_.end());
176 delete it->second; 174 delete it->second;
177 hosts_.erase(it); 175 hosts_.erase(it);
178 } 176 }
179 177
180 } // namespace content 178 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/text_input_client_message_filter.mm ('k') | content/browser/resolve_proxy_msg_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698