OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" | 5 #include "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" |
6 | 6 |
7 #include "chrome/browser/chrome_thread.h" | 7 #include "chrome/browser/chrome_thread.h" |
8 #include "chrome/browser/net/url_request_context_getter.h" | 8 #include "chrome/browser/net/url_request_context_getter.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Profile::GetDefaultRequestContext() is initialized lazily, on the UI | 39 // Profile::GetDefaultRequestContext() is initialized lazily, on the UI |
40 // thread. So here, where we access it from the IO thread, if the task runs | 40 // thread. So here, where we access it from the IO thread, if the task runs |
41 // before it has gotten lazily initialized yet. | 41 // before it has gotten lazily initialized yet. |
42 if (!getter) | 42 if (!getter) |
43 return NULL; | 43 return NULL; |
44 net::WebSocket::Request* request( | 44 net::WebSocket::Request* request( |
45 new net::WebSocket::Request(config.url, | 45 new net::WebSocket::Request(config.url, |
46 config.ws_protocol, | 46 config.ws_protocol, |
47 config.ws_origin, | 47 config.ws_origin, |
48 config.ws_location, | 48 config.ws_location, |
| 49 net::WebSocket::DRAFT75, |
49 getter->GetURLRequestContext())); | 50 getter->GetURLRequestContext())); |
50 return new net::WebSocket(request, delegate); | 51 return new net::WebSocket(request, delegate); |
51 } | 52 } |
52 | 53 |
53 WebSocketExperimentTask::WebSocketExperimentTask( | 54 WebSocketExperimentTask::WebSocketExperimentTask( |
54 const Config& config, | 55 const Config& config, |
55 net::CompletionCallback* callback) | 56 net::CompletionCallback* callback) |
56 : config_(config), | 57 : config_(config), |
57 context_(ALLOW_THIS_IN_INITIALIZER_LIST(new Context())), | 58 context_(ALLOW_THIS_IN_INITIALIZER_LIST(new Context())), |
58 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 59 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void WebSocketExperimentTask::Finish(int result) { | 402 void WebSocketExperimentTask::Finish(int result) { |
402 url_fetcher_.reset(); | 403 url_fetcher_.reset(); |
403 scoped_refptr<net::WebSocket> websocket = websocket_; | 404 scoped_refptr<net::WebSocket> websocket = websocket_; |
404 websocket_ = NULL; | 405 websocket_ = NULL; |
405 callback_->Run(result); | 406 callback_->Run(result); |
406 if (websocket) | 407 if (websocket) |
407 websocket->DetachDelegate(); | 408 websocket->DetachDelegate(); |
408 } | 409 } |
409 | 410 |
410 } // namespace chrome_browser_net | 411 } // namespace chrome_browser_net |
OLD | NEW |