1 // Copyright 2014 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 "chrome/browser/devtools/devtools_network_transaction_factory.h"
10 #include "chrome/browser/devtools/devtools_network_controller.h"
11 #include "chrome/browser/devtools/devtools_network_transaction.h"
12 #include "content/public/browser/service_worker_context.h"
13 #include "net/base/net_errors.h"
14 #include "net/http/http_network_layer.h"
15 #include "net/http/http_network_transaction.h"
17 DevToolsNetworkTransactionFactory::DevToolsNetworkTransactionFactory(
18 DevToolsNetworkController
* controller
,
19 net::HttpNetworkSession
* session
)
20 : controller_(controller
),
21 network_layer_(new net::HttpNetworkLayer(session
)) {
22 std::set
<std::string
> headers
;
23 headers
.insert(DevToolsNetworkTransaction::kDevToolsRequestInitiator
);
25 DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId
);
26 content::ServiceWorkerContext::AddExcludedHeadersForFetchEvent(headers
);
29 DevToolsNetworkTransactionFactory::~DevToolsNetworkTransactionFactory() {
32 int DevToolsNetworkTransactionFactory::CreateTransaction(
33 net::RequestPriority priority
,
34 scoped_ptr
<net::HttpTransaction
>* trans
) {
35 scoped_ptr
<net::HttpTransaction
> network_transaction
;
36 int rv
= network_layer_
->CreateTransaction(priority
, &network_transaction
);
41 new DevToolsNetworkTransaction(controller_
, network_transaction
.Pass()));
45 net::HttpCache
* DevToolsNetworkTransactionFactory::GetCache() {
46 return network_layer_
->GetCache();
49 net::HttpNetworkSession
* DevToolsNetworkTransactionFactory::GetSession() {
50 return network_layer_
->GetSession();