OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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. | |
4 | |
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ | |
7 | |
8 #include "base/containers/hash_tables.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "net/http/http_transaction_factory.h" | |
12 | |
13 class DevToolsNetworkTransaction; | |
14 class GURL; | |
15 class Profile; | |
16 | |
17 namespace net { | |
18 class HttpNetworkSession; | |
19 class HttpTransaction; | |
20 enum RequestPriority; | |
21 } // namespace net | |
mmenke
2014/03/11 21:16:53
nit: Two spaces before comment.
eustas
2014/03/12 15:38:33
Done.
| |
22 | |
23 namespace content { | |
24 class BrowserContext; | |
25 } // namespace content | |
mmenke
2014/03/11 21:16:53
nit: Two spaces before comment.
eustas
2014/03/12 15:38:33
Done.
| |
26 | |
27 // DevToolsNetworkController wraps and tracks HttpNetworkTrancactions. | |
mmenke
2014/03/11 21:16:53
nit: HttpNetworkTrancactions -> HttpNetworkTransa
eustas
2014/03/12 15:38:33
Done.
| |
28 class DevToolsNetworkController | |
29 : public net::HttpTransactionFactory { | |
30 | |
31 public: | |
32 explicit DevToolsNetworkController(net::HttpNetworkSession* session); | |
33 virtual ~DevToolsNetworkController(); | |
34 | |
35 static void SetBlockedDomains( | |
36 Profile* profile, | |
37 const std::string& id, | |
38 const std::vector<std::string>& blocked_domains); | |
mmenke
2014/03/11 21:16:53
I am a little concerned that this is working at th
eustas
2014/03/12 15:38:33
Service Worker and AppCache are the main reasons w
mmenke
2014/03/12 15:59:27
I had completely forgotten about remote debugging.
| |
39 | |
40 bool IsBlockedURL(const GURL& url); | |
41 | |
42 void RemoveTransaction(const std::string& id); | |
43 void SetBlockedDomainsOnIO( | |
44 const std::string& id, | |
45 const std::vector<std::string>& blocked_domains); | |
46 | |
47 // net::HttpTransactionFactory methods: | |
48 virtual int CreateTransaction( | |
49 net::RequestPriority priority, | |
50 scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; | |
51 virtual net::HttpCache* GetCache() OVERRIDE; | |
52 virtual net::HttpNetworkSession* GetSession() OVERRIDE; | |
53 | |
54 private: | |
55 scoped_ptr<net::HttpTransactionFactory> network_layer_; | |
56 | |
57 typedef base::hash_map<std::string, DevToolsNetworkTransaction*> Transactions; | |
58 Transactions transactions_; | |
59 | |
60 typedef std::vector<std::string> BlockedDomains; | |
61 typedef base::hash_map<std::string, BlockedDomains*> BlockedDomainsMap; | |
62 BlockedDomainsMap blocked_domains_map_; | |
63 | |
64 base::WeakPtrFactory<DevToolsNetworkController> weak_factory_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController); | |
67 }; | |
68 | |
69 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ | |
OLD | NEW |