Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: chrome/browser/net/network_controller.h

Issue 182993003: Add the ability for DevTools to wrap network transactions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_
6 #define CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/containers/hash_tables.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "net/base/request_priority.h"
15 #include "net/http/http_transaction_factory.h"
16
17 class NetworkTransaction;
18 class GURL;
19 class Profile;
20
21 namespace net {
22 class HttpCache;
23 class HttpNetworkSession;
24 class HttpTransaction;
25 } // namespace net
26
27 namespace content {
28 class BrowserContext;
29 class ResourceContext;
30 } // namespace content
31
32 // NetworkController wraps and tracks HttpNetworkTransactions.
33 class NetworkController
34 : public net::HttpTransactionFactory {
35
36 public:
37 explicit NetworkController(net::HttpNetworkSession* session);
38 virtual ~NetworkController();
39
40 void AddTransaction(
41 uint64 transaction_id,
42 NetworkTransaction* transaction);
43
44 void RemoveTransaction(uint64 transaction_id);
45
46 static void SetBlockedDomains(
47 Profile* profile,
48 const std::string& client_id,
49 const std::vector<std::string>& blocked_domains);
50
51 static void SetBlockedDomainsOnIO(
52 content::ResourceContext* resourceContext,
53 const std::string& client_id,
54 const std::vector<std::string>& blocked_domains);
55
56 void SetBlockedDomains(
57 const std::string& client_id,
58 const std::vector<std::string>& blocked_domains);
59
60 bool IsBlockedURL(const GURL& url);
61
62 // net::HttpTransactionFactory methods:
63 virtual int CreateTransaction(
64 net::RequestPriority priority,
65 scoped_ptr<net::HttpTransaction>* trans) OVERRIDE;
66 virtual net::HttpCache* GetCache() OVERRIDE;
67 virtual net::HttpNetworkSession* GetSession() OVERRIDE;
68
69 private:
70 scoped_ptr<net::HttpTransactionFactory> network_layer_;
71
72 typedef base::hash_map<uint64, NetworkTransaction*> Transactions;
73 Transactions transactions_;
74
75 typedef std::vector<std::string> BlockedDomains;
76 typedef base::hash_map<std::string, BlockedDomains*> BlockedDomainsMap;
77 BlockedDomainsMap blocked_domains_map_;
78
79 DISALLOW_COPY_AND_ASSIGN(NetworkController);
80 };
81
82 #endif // CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698