[Android] Remove the webview_core static library.
[chromium-blink-merge.git] / net / http / http_network_layer.h
blobd9eb676b989ba0810547b21e33623f8494019477
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_NETWORK_LAYER_H_
6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/system_monitor/system_monitor.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "net/base/net_export.h"
15 #include "net/http/http_transaction_factory.h"
17 namespace net {
19 class HttpNetworkSession;
21 class NET_EXPORT HttpNetworkLayer
22 : public HttpTransactionFactory,
23 public base::SystemMonitor::PowerObserver,
24 NON_EXPORTED_BASE(public base::NonThreadSafe) {
25 public:
26 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which
27 // contains a valid ProxyService.
28 explicit HttpNetworkLayer(HttpNetworkSession* session);
29 virtual ~HttpNetworkLayer();
31 // Create a transaction factory that instantiate a network layer over an
32 // existing network session. Network session contains some valuable
33 // information (e.g. authentication data) that we want to share across
34 // multiple network layers. This method exposes the implementation details
35 // of a network layer, use this method with an existing network layer only
36 // when network session is shared.
37 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session);
39 // Enable the spdy protocol.
40 // Without calling this function, SPDY is disabled. The mode can be:
41 // "" : (default) SSL and compression are enabled, flow
42 // control disabled.
43 // "no-ssl" : disables SSL.
44 // "no-compress" : disables compression.
45 // "flow-control": enables flow control.
46 // "none" : disables both SSL and compression.
47 static void EnableSpdy(const std::string& mode);
49 // HttpTransactionFactory methods:
50 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans,
51 HttpTransactionDelegate* delegate) OVERRIDE;
52 virtual HttpCache* GetCache() OVERRIDE;
53 virtual HttpNetworkSession* GetSession() OVERRIDE;
55 // base::SystemMonitor::PowerObserver methods:
56 virtual void OnSuspend() OVERRIDE;
57 virtual void OnResume() OVERRIDE;
59 private:
60 const scoped_refptr<HttpNetworkSession> session_;
61 bool suspended_;
64 } // namespace net
66 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_