OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 SocketStreamJob(); | 44 SocketStreamJob(); |
45 void InitSocketStream(SocketStream* socket) { | 45 void InitSocketStream(SocketStream* socket) { |
46 socket_ = socket; | 46 socket_ = socket; |
47 } | 47 } |
48 | 48 |
49 virtual SocketStream::UserData* GetUserData(const void* key) const; | 49 virtual SocketStream::UserData* GetUserData(const void* key) const; |
50 virtual void SetUserData(const void* key, SocketStream::UserData* data); | 50 virtual void SetUserData(const void* key, SocketStream::UserData* data); |
51 | 51 |
52 URLRequestContext* context() const { | 52 URLRequestContext* context() const { |
53 return socket_ ? socket_->context() : 0; | 53 return socket_.get() ? socket_->context() : 0; |
54 } | 54 } |
55 void set_context(URLRequestContext* context) { | 55 void set_context(URLRequestContext* context) { |
56 if (socket_) | 56 if (socket_.get()) |
57 socket_->set_context(context); | 57 socket_->set_context(context); |
58 } | 58 } |
59 | 59 |
60 virtual void Connect(); | 60 virtual void Connect(); |
61 | 61 |
62 virtual bool SendData(const char* data, int len); | 62 virtual bool SendData(const char* data, int len); |
63 | 63 |
64 virtual void Close(); | 64 virtual void Close(); |
65 | 65 |
66 virtual void RestartWithAuth(const AuthCredentials& credentials); | 66 virtual void RestartWithAuth(const AuthCredentials& credentials); |
67 | 67 |
(...skipping 11 matching lines...) Expand all Loading... |
79 virtual ~SocketStreamJob(); | 79 virtual ~SocketStreamJob(); |
80 | 80 |
81 scoped_refptr<SocketStream> socket_; | 81 scoped_refptr<SocketStream> socket_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); | 83 DISALLOW_COPY_AND_ASSIGN(SocketStreamJob); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace net | 86 } // namespace net |
87 | 87 |
88 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ | 88 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_JOB_H_ |
OLD | NEW |