Prevent bookmark apps from triggering a sync loop.
[chromium-blink-merge.git] / net / http / http_pipelined_host_forced.h
blob2c3c915934269642b2de09a0df6d34ddfcc2c7ac
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
3 // found in the LICENSE file.
5 #ifndef NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_
6 #define NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/host_port_pair.h"
13 #include "net/base/net_export.h"
14 #include "net/http/http_pipelined_connection.h"
15 #include "net/http/http_pipelined_host.h"
16 #include "net/http/http_pipelined_host_capability.h"
18 namespace base {
19 class Value;
22 namespace net {
24 class BoundNetLog;
25 class ClientSocketHandle;
26 class HttpPipelinedStream;
27 class ProxyInfo;
28 struct SSLConfig;
30 // Manages a single pipelined connection for requests to a host that are forced
31 // to use pipelining. Note that this is normally not used. It is intended to
32 // test the user's connection for pipelining compatibility.
33 class NET_EXPORT_PRIVATE HttpPipelinedHostForced
34 : public HttpPipelinedHost,
35 public HttpPipelinedConnection::Delegate {
36 public:
37 HttpPipelinedHostForced(HttpPipelinedHost::Delegate* delegate,
38 const Key& key,
39 HttpPipelinedConnection::Factory* factory);
40 virtual ~HttpPipelinedHostForced();
42 // HttpPipelinedHost interface
43 virtual HttpPipelinedStream* CreateStreamOnNewPipeline(
44 ClientSocketHandle* connection,
45 const SSLConfig& used_ssl_config,
46 const ProxyInfo& used_proxy_info,
47 const BoundNetLog& net_log,
48 bool was_npn_negotiated,
49 NextProto protocol_negotiated) OVERRIDE;
51 virtual HttpPipelinedStream* CreateStreamOnExistingPipeline() OVERRIDE;
53 virtual bool IsExistingPipelineAvailable() const OVERRIDE;
55 virtual const Key& GetKey() const OVERRIDE;
57 virtual base::Value* PipelineInfoToValue() const OVERRIDE;
59 // HttpPipelinedConnection::Delegate interface
61 virtual void OnPipelineHasCapacity(
62 HttpPipelinedConnection* pipeline) OVERRIDE;
64 virtual void OnPipelineFeedback(
65 HttpPipelinedConnection* pipeline,
66 HttpPipelinedConnection::Feedback feedback) OVERRIDE;
68 private:
69 // Called when a pipeline is empty and there are no pending requests. Closes
70 // the connection.
71 void OnPipelineEmpty(HttpPipelinedConnection* pipeline);
73 HttpPipelinedHost::Delegate* delegate_;
74 const Key key_;
75 scoped_ptr<HttpPipelinedConnection> pipeline_;
76 scoped_ptr<HttpPipelinedConnection::Factory> factory_;
78 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedHostForced);
81 } // namespace net
83 #endif // NET_HTTP_HTTP_PIPELINED_HOST_FORCED_H_