Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: chrome/browser/renderer_host/socket_stream_host.h

Issue 6056007: net: Add namespace net to the remaining files under url_request directory. (Closed)
Patch Set: chromeos fixes Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 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 CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
6 #define CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "net/socket_stream/socket_stream.h" 12 #include "net/socket_stream/socket_stream.h"
13 13
14 class GURL; 14 class GURL;
15 class URLRequestContext;
16 15
17 namespace net { 16 namespace net {
18 class SocketStreamJob; 17 class SocketStreamJob;
19 } 18 class URLRequestContext;
19 } // namespace net
20 20
21 // Host of SocketStreamHandle. 21 // Host of SocketStreamHandle.
22 // Each SocketStreamHandle will have an unique socket_id assigned by 22 // Each SocketStreamHandle will have an unique socket_id assigned by
23 // SocketStreamHost constructor. If socket id is chrome_common_net::kNoSocketId, 23 // SocketStreamHost constructor. If socket id is chrome_common_net::kNoSocketId,
24 // there is no SocketStreamHost. 24 // there is no SocketStreamHost.
25 // Each SocketStreamHost has SocketStream to manage bi-directional 25 // Each SocketStreamHost has SocketStream to manage bi-directional
26 // communication over socket stream. 26 // communication over socket stream.
27 // The lifetime of an instance of this class is completely controlled by the 27 // The lifetime of an instance of this class is completely controlled by the
28 // SocketStreamDispatcherHost. 28 // SocketStreamDispatcherHost.
29 class SocketStreamHost { 29 class SocketStreamHost {
30 public: 30 public:
31 SocketStreamHost(net::SocketStream::Delegate* delegate, int socket_id); 31 SocketStreamHost(net::SocketStream::Delegate* delegate, int socket_id);
32 ~SocketStreamHost(); 32 ~SocketStreamHost();
33 33
34 // Gets socket_id associated with |socket|. 34 // Gets socket_id associated with |socket|.
35 static int SocketIdFromSocketStream(net::SocketStream* socket); 35 static int SocketIdFromSocketStream(net::SocketStream* socket);
36 36
37 int socket_id() const { return socket_id_; } 37 int socket_id() const { return socket_id_; }
38 38
39 // Starts to open connection to |url|. 39 // Starts to open connection to |url|.
40 void Connect(const GURL& url, URLRequestContext* request_context); 40 void Connect(const GURL& url, net::URLRequestContext* request_context);
41 41
42 // Sends |data| over the socket stream. 42 // Sends |data| over the socket stream.
43 // socket stream must be open to send data. 43 // socket stream must be open to send data.
44 // Returns true if the data is put in transmit buffer in socket stream. 44 // Returns true if the data is put in transmit buffer in socket stream.
45 // Returns false otherwise (transmit buffer exceeds limit, or socket 45 // Returns false otherwise (transmit buffer exceeds limit, or socket
46 // stream is closed). 46 // stream is closed).
47 bool SendData(const std::vector<char>& data); 47 bool SendData(const std::vector<char>& data);
48 48
49 // Closes the socket stream. 49 // Closes the socket stream.
50 void Close(); 50 void Close();
51 51
52 private: 52 private:
53 net::SocketStream::Delegate* delegate_; 53 net::SocketStream::Delegate* delegate_;
54 int socket_id_; 54 int socket_id_;
55 55
56 scoped_refptr<net::SocketStreamJob> socket_; 56 scoped_refptr<net::SocketStreamJob> socket_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(SocketStreamHost); 58 DISALLOW_COPY_AND_ASSIGN(SocketStreamHost);
59 }; 59 };
60 60
61 #endif // CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_ 61 #endif // CHROME_BROWSER_RENDERER_HOST_SOCKET_STREAM_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/socket_stream_dispatcher_host.h ('k') | chrome/browser/renderer_host/sync_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698