http_network_layer.h revision ddb351dbec246cf1fab5ec20d2d5520909041de1
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 3// found in the LICENSE file. 4 5#ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ 6#define NET_HTTP_HTTP_NETWORK_LAYER_H_ 7#pragma once 8 9#include <string> 10 11#include "base/memory/ref_counted.h" 12#include "base/memory/scoped_ptr.h" 13#include "base/threading/non_thread_safe.h" 14#include "net/http/http_transaction_factory.h" 15 16namespace net { 17 18class CertVerifier; 19class ClientSocketFactory; 20class DnsCertProvenanceChecker; 21class DnsRRResolver; 22class HostResolver; 23class HttpAuthHandlerFactory; 24class HttpNetworkSession; 25class NetLog; 26class NetworkDelegate; 27class ProxyService; 28class SpdySessionPool; 29class SSLConfigService; 30class SSLHostInfoFactory; 31 32class HttpNetworkLayer : public HttpTransactionFactory, 33 public base::NonThreadSafe { 34 public: 35 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which 36 // contains a valid ProxyService. 37 explicit HttpNetworkLayer(HttpNetworkSession* session); 38 virtual ~HttpNetworkLayer(); 39 40 // Create a transaction factory that instantiate a network layer over an 41 // existing network session. Network session contains some valuable 42 // information (e.g. authentication data) that we want to share across 43 // multiple network layers. This method exposes the implementation details 44 // of a network layer, use this method with an existing network layer only 45 // when network session is shared. 46 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); 47 48 // Enable the spdy protocol. 49 // Without calling this function, SPDY is disabled. The mode can be: 50 // "" : (default) SSL and compression are enabled, flow 51 // control disabled. 52 // "no-ssl" : disables SSL. 53 // "no-compress" : disables compression. 54 // "flow-control": enables flow control. 55 // "none" : disables both SSL and compression. 56 static void EnableSpdy(const std::string& mode); 57 58 // HttpTransactionFactory methods: 59 virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); 60 virtual HttpCache* GetCache(); 61 virtual HttpNetworkSession* GetSession(); 62 virtual void Suspend(bool suspend); 63 64 private: 65 const scoped_refptr<HttpNetworkSession> session_; 66 bool suspended_; 67}; 68 69} // namespace net 70 71#endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ 72