OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/socket_stream/socket_stream_job.h" | 5 #include "net/socket_stream/socket_stream_job.h" |
6 | 6 |
7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
8 #include "net/socket_stream/socket_stream_job_manager.h" | 8 #include "net/socket_stream/socket_stream_job_manager.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 static SocketStreamJobManager* GetJobManager() { | |
13 return Singleton<SocketStreamJobManager>::get(); | |
14 } | |
15 | |
16 // static | 12 // static |
17 SocketStreamJob::ProtocolFactory* SocketStreamJob::RegisterProtocolFactory( | 13 SocketStreamJob::ProtocolFactory* SocketStreamJob::RegisterProtocolFactory( |
18 const std::string& scheme, ProtocolFactory* factory) { | 14 const std::string& scheme, ProtocolFactory* factory) { |
19 return GetJobManager()->RegisterProtocolFactory(scheme, factory); | 15 return SocketStreamJobManager::GetInstance()->RegisterProtocolFactory( |
| 16 scheme, factory); |
20 } | 17 } |
21 | 18 |
22 // static | 19 // static |
23 SocketStreamJob* SocketStreamJob::CreateSocketStreamJob( | 20 SocketStreamJob* SocketStreamJob::CreateSocketStreamJob( |
24 const GURL& url, SocketStream::Delegate* delegate) { | 21 const GURL& url, SocketStream::Delegate* delegate) { |
25 return GetJobManager()->CreateJob(url, delegate); | 22 return SocketStreamJobManager::GetInstance()->CreateJob(url, delegate); |
26 } | 23 } |
27 | 24 |
28 SocketStreamJob::SocketStreamJob() {} | 25 SocketStreamJob::SocketStreamJob() {} |
29 | 26 |
30 SocketStream::UserData* SocketStreamJob::GetUserData(const void* key) const { | 27 SocketStream::UserData* SocketStreamJob::GetUserData(const void* key) const { |
31 return socket_->GetUserData(key); | 28 return socket_->GetUserData(key); |
32 } | 29 } |
33 | 30 |
34 void SocketStreamJob::SetUserData(const void* key, | 31 void SocketStreamJob::SetUserData(const void* key, |
35 SocketStream::UserData* data) { | 32 SocketStream::UserData* data) { |
(...skipping 17 matching lines...) Expand all Loading... |
53 socket_->RestartWithAuth(username, password); | 50 socket_->RestartWithAuth(username, password); |
54 } | 51 } |
55 | 52 |
56 void SocketStreamJob::DetachDelegate() { | 53 void SocketStreamJob::DetachDelegate() { |
57 socket_->DetachDelegate(); | 54 socket_->DetachDelegate(); |
58 } | 55 } |
59 | 56 |
60 SocketStreamJob::~SocketStreamJob() {} | 57 SocketStreamJob::~SocketStreamJob() {} |
61 | 58 |
62 } // namespace net | 59 } // namespace net |
OLD | NEW |