Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
| 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 class SocketStreamJob : public base::RefCountedThreadSafe<SocketStreamJob> { | 25 class SocketStreamJob : public base::RefCountedThreadSafe<SocketStreamJob> { |
| 26 public: | 26 public: |
| 27 // Callback function implemented by protocol handlers to create new jobs. | 27 // Callback function implemented by protocol handlers to create new jobs. |
| 28 typedef SocketStreamJob* (ProtocolFactory)(const GURL& url, | 28 typedef SocketStreamJob* (ProtocolFactory)(const GURL& url, |
| 29 SocketStream::Delegate* delegate); | 29 SocketStream::Delegate* delegate); |
| 30 | 30 |
| 31 static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme, | 31 static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme, |
| 32 ProtocolFactory* factory); | 32 ProtocolFactory* factory); |
| 33 | 33 |
| 34 static SocketStreamJob* CreateSocketStreamJob( | 34 static SocketStreamJob* CreateSocketStreamJob( |
| 35 const GURL& url, SocketStream::Delegate* delegate); | 35 const GURL& url, |
| 36 SocketStream::Delegate* delegate, | |
| 37 const URLRequestContext& context); | |
|
willchan no longer on Chromium
2011/04/29 19:09:46
Please pass in the exact dependencies. I'm trying
| |
| 36 | 38 |
| 37 SocketStreamJob(); | 39 SocketStreamJob(); |
| 38 void InitSocketStream(SocketStream* socket) { | 40 void InitSocketStream(SocketStream* socket) { |
| 39 socket_ = socket; | 41 socket_ = socket; |
| 40 } | 42 } |
| 41 | 43 |
| 42 virtual SocketStream::UserData* GetUserData(const void* key) const; | 44 virtual SocketStream::UserData* GetUserData(const void* key) const; |
| 43 virtual void SetUserData(const void* key, SocketStream::UserData* data); | 45 virtual void SetUserData(const void* key, SocketStream::UserData* data); |
| 44 | 46 |
| 45 URLRequestContext* context() const { | 47 URLRequestContext* context() const { |
| 46 return socket_->context(); | 48 return socket_->context(); |
| 47 } | 49 } |
| 48 void set_context(URLRequestContext* context) { | 50 void set_context(URLRequestContext* context) { |
| 49 socket_->set_context(context); | 51 socket_->set_context(context); |
| 50 } | 52 } |
| 51 | 53 |
| 52 virtual void Connect(); | 54 virtual void Connect(); |
| 53 | 55 |
| 54 virtual bool SendData(const char* data, int len); | 56 virtual bool SendData(const char* data, int len); |
| 55 | 57 |
| 56 virtual void Close(); | 58 virtual void Close(); |
| 57 | 59 |
| 58 virtual void RestartWithAuth(const string16& username, | 60 virtual void RestartWithAuth(const string16& username, |
| 59 const string16& password); | 61 const string16& password); |
| 60 | 62 |
| 61 virtual void DetachDelegate(); | 63 virtual void DetachDelegate(); |
| 62 | 64 |
| 63 protected: | 65 protected: |
| 66 friend class WebSocketJobTest; | |
| 64 friend class base::RefCountedThreadSafe<SocketStreamJob>; | 67 friend class base::RefCountedThreadSafe<SocketStreamJob>; |
| 65 virtual ~SocketStreamJob(); | 68 virtual ~SocketStreamJob(); |
| 66 | 69 |
| 67 scoped_refptr<SocketStream> socket_; | 70 scoped_refptr<SocketStream> socket_; |
| 68 | 71 |
| 69 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); | 72 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } // namespace net | 75 } // namespace net |
| 73 | 76 |
| 74 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 77 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
| OLD | NEW |