OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/spy/spy.h" | 5 #include "mojo/spy/spy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 explicit SpyInterceptor( | 232 explicit SpyInterceptor( |
233 scoped_refptr<mojo::SpyServerImpl> spy_server, | 233 scoped_refptr<mojo::SpyServerImpl> spy_server, |
234 const scoped_refptr<base::MessageLoopProxy>& control_loop_proxy, | 234 const scoped_refptr<base::MessageLoopProxy>& control_loop_proxy, |
235 mojo::Spy::WebSocketDelegate* websocket_delegate) | 235 mojo::Spy::WebSocketDelegate* websocket_delegate) |
236 : spy_server_(spy_server), | 236 : spy_server_(spy_server), |
237 proxy_(base::MessageLoopProxy::current()), | 237 proxy_(base::MessageLoopProxy::current()), |
238 control_loop_proxy_(control_loop_proxy), | 238 control_loop_proxy_(control_loop_proxy), |
239 websocket_delegate_(websocket_delegate) {} | 239 websocket_delegate_(websocket_delegate) {} |
240 | 240 |
241 private: | 241 private: |
242 virtual mojo::ServiceProviderPtr OnConnectToClient( | 242 mojo::ServiceProviderPtr OnConnectToClient( |
243 const GURL& url, mojo::ServiceProviderPtr real_client) override { | 243 const GURL& url, |
| 244 mojo::ServiceProviderPtr real_client) override { |
244 if (!MustIntercept(url)) | 245 if (!MustIntercept(url)) |
245 return real_client.Pass(); | 246 return real_client.Pass(); |
246 | 247 |
247 // You can get an invalid handle if the app (or service) is | 248 // You can get an invalid handle if the app (or service) is |
248 // created by unconventional means, for example the command line. | 249 // created by unconventional means, for example the command line. |
249 if (!real_client) | 250 if (!real_client) |
250 return real_client.Pass(); | 251 return real_client.Pass(); |
251 | 252 |
252 mojo::ScopedMessagePipeHandle faux_client; | 253 mojo::ScopedMessagePipeHandle faux_client; |
253 mojo::ScopedMessagePipeHandle interceptor; | 254 mojo::ScopedMessagePipeHandle interceptor; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 base::Bind(&WebSocketDelegate::Start, | 341 base::Bind(&WebSocketDelegate::Start, |
341 base::Unretained(websocket_delegate_), | 342 base::Unretained(websocket_delegate_), |
342 spy_options_->websocket_port, | 343 spy_options_->websocket_port, |
343 base::Passed(spy_server_->ServerPipe()))); | 344 base::Passed(spy_server_->ServerPipe()))); |
344 // Start intercepting mojo services. | 345 // Start intercepting mojo services. |
345 application_manager_->SetInterceptor(new SpyInterceptor( | 346 application_manager_->SetInterceptor(new SpyInterceptor( |
346 spy_server_, control_thread_->message_loop_proxy(), websocket_delegate_)); | 347 spy_server_, control_thread_->message_loop_proxy(), websocket_delegate_)); |
347 } | 348 } |
348 | 349 |
349 } // namespace mojo | 350 } // namespace mojo |
OLD | NEW |