Update include paths in miscellaneous content/ directories for base/process changes.
[chromium-blink-merge.git] / net / http / http_network_layer.cc
blobe4d082eb0fdfd8355145ac0177a924b0706e76a3
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 #include "net/http/http_network_layer.h"
7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h"
11 #include "net/http/http_network_session.h"
12 #include "net/http/http_network_transaction.h"
13 #include "net/http/http_server_properties_impl.h"
14 #include "net/http/http_stream_factory_impl_job.h"
15 #include "net/spdy/spdy_framer.h"
16 #include "net/spdy/spdy_session.h"
17 #include "net/spdy/spdy_session_pool.h"
19 namespace net {
21 //-----------------------------------------------------------------------------
22 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session)
23 : session_(session),
24 suspended_(false) {
25 DCHECK(session_.get());
28 HttpNetworkLayer::~HttpNetworkLayer() {
31 //-----------------------------------------------------------------------------
33 // static
34 HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
35 HttpNetworkSession* session) {
36 DCHECK(session);
38 return new HttpNetworkLayer(session);
41 // static
42 void HttpNetworkLayer::ForceAlternateProtocol() {
43 PortAlternateProtocolPair pair;
44 pair.port = 443;
45 pair.protocol = NPN_SPDY_2;
46 HttpServerPropertiesImpl::ForceAlternateProtocol(pair);
49 //-----------------------------------------------------------------------------
51 int HttpNetworkLayer::CreateTransaction(RequestPriority priority,
52 scoped_ptr<HttpTransaction>* trans,
53 HttpTransactionDelegate* delegate) {
54 if (suspended_)
55 return ERR_NETWORK_IO_SUSPENDED;
57 trans->reset(new HttpNetworkTransaction(priority, GetSession()));
58 return OK;
61 HttpCache* HttpNetworkLayer::GetCache() {
62 return NULL;
65 HttpNetworkSession* HttpNetworkLayer::GetSession() { return session_.get(); }
67 void HttpNetworkLayer::OnSuspend() {
68 suspended_ = true;
70 if (session_.get())
71 session_->CloseIdleConnections();
74 void HttpNetworkLayer::OnResume() {
75 suspended_ = false;
78 } // namespace net