[Presentation API, Android] Implement basic messaging
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_network_controller.h
blob2fe0880363eba738109590cef3776aea13d05e5c
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_
8 #include <string>
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 {
22 public:
23 DevToolsNetworkController();
24 virtual ~DevToolsNetworkController();
26 // Applies network emulation configuration.
27 void SetNetworkState(
28 const std::string& client_id,
29 scoped_ptr<DevToolsNetworkConditions> conditions);
31 base::WeakPtr<DevToolsNetworkInterceptor> GetInterceptor(
32 DevToolsNetworkTransaction* transaction);
34 private:
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_