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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h"
16 class DevToolsNetworkConditions
;
17 class DevToolsNetworkInterceptor
;
18 class DevToolsNetworkTransaction
;
20 // DevToolsNetworkController tracks DevToolsNetworkTransactions.
21 class DevToolsNetworkController
{
23 DevToolsNetworkController();
24 virtual ~DevToolsNetworkController();
26 // Applies network emulation configuration.
28 const std::string
& client_id
,
29 scoped_ptr
<DevToolsNetworkConditions
> conditions
);
31 base::WeakPtr
<DevToolsNetworkInterceptor
> GetInterceptor(
32 DevToolsNetworkTransaction
* transaction
);
35 using InterceptorMap
=
36 base::ScopedPtrHashMap
<std::string
,
37 scoped_ptr
<DevToolsNetworkInterceptor
>>;
39 scoped_ptr
<DevToolsNetworkInterceptor
> default_interceptor_
;
40 scoped_ptr
<DevToolsNetworkInterceptor
> appcache_interceptor_
;
41 InterceptorMap interceptors_
;
42 base::ThreadChecker thread_checker_
;
44 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController
);
47 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_