OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
mmenke
2014/03/12 15:59:27
nit: New files shouldn't use the "(c)"
eustas
2014/03/13 13:11:09
Done.
| |
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_NET_NETWORK_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ | |
7 | |
mmenke
2014/03/12 15:59:27
nit: include <vector> and <string>
eustas
2014/03/13 13:11:09
Done.
| |
8 #include "base/containers/hash_tables.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "net/http/http_transaction_factory.h" | |
11 | |
12 class NetworkTransaction; | |
13 class GURL; | |
14 class Profile; | |
15 | |
16 namespace net { | |
17 class HttpNetworkSession; | |
18 class HttpTransaction; | |
19 enum RequestPriority; | |
mmenke
2014/03/12 15:59:27
Don't forward declare enums. This is C++11, so no
mmenke
2014/03/12 15:59:27
Should probably include HttpCache in this list.
eustas
2014/03/13 13:11:09
Done.
eustas
2014/03/13 13:11:09
Done.
| |
20 } // namespace net | |
21 | |
22 namespace content { | |
23 class BrowserContext; | |
24 } // namespace content | |
25 | |
26 // NetworkController wraps and tracks HttpNetworkTransactions. | |
27 class NetworkController | |
28 : public net::HttpTransactionFactory { | |
29 | |
30 public: | |
31 explicit NetworkController(net::HttpNetworkSession* session); | |
32 virtual ~NetworkController(); | |
33 | |
34 void AddTransaction( | |
35 uint64 transaction_id, | |
36 NetworkTransaction* transaction); | |
37 | |
38 void RemoveTransaction(uint64 transaction_id); | |
39 | |
40 static void SetBlockedDomains( | |
41 Profile* profile, | |
42 const std::string& client_id, | |
43 const std::vector<std::string>& blocked_domains); | |
44 | |
45 static void SetBlockedDomainsOnIO( | |
46 Profile* profile, | |
47 const std::string& client_id, | |
48 const std::vector<std::string>& blocked_domains); | |
49 | |
50 void SetBlockedDomains( | |
51 const std::string& client_id, | |
52 const std::vector<std::string>& blocked_domains); | |
53 | |
54 bool IsBlockedURL(const GURL& url); | |
55 | |
56 // net::HttpTransactionFactory methods: | |
57 virtual int CreateTransaction( | |
58 net::RequestPriority priority, | |
59 scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; | |
60 virtual net::HttpCache* GetCache() OVERRIDE; | |
61 virtual net::HttpNetworkSession* GetSession() OVERRIDE; | |
62 | |
63 private: | |
64 scoped_ptr<net::HttpTransactionFactory> network_layer_; | |
65 | |
66 typedef base::hash_map<uint64, NetworkTransaction*> Transactions; | |
67 Transactions transactions_; | |
68 | |
69 typedef std::vector<std::string> BlockedDomains; | |
70 typedef base::hash_map<std::string, BlockedDomains*> BlockedDomainsMap; | |
71 BlockedDomainsMap blocked_domains_map_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(NetworkController); | |
mmenke
2014/03/12 15:59:27
Should include the headers for this and OVERRIDE (
eustas
2014/03/13 13:11:09
Done.
| |
74 }; | |
75 | |
76 #endif // CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ | |
OLD | NEW |