Index: chrome/browser/net/network_controller.h |
diff --git a/chrome/browser/net/network_controller.h b/chrome/browser/net/network_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..41108289da0367dd0e4c379766c362001da8d043 |
--- /dev/null |
+++ b/chrome/browser/net/network_controller.h |
@@ -0,0 +1,76 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ |
+#define CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ |
+ |
mmenke
2014/03/12 15:59:27
nit: include <vector> and <string>
eustas
2014/03/13 13:11:09
Done.
|
+#include "base/containers/hash_tables.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "net/http/http_transaction_factory.h" |
+ |
+class NetworkTransaction; |
+class GURL; |
+class Profile; |
+ |
+namespace net { |
+class HttpNetworkSession; |
+class HttpTransaction; |
+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.
|
+} // namespace net |
+ |
+namespace content { |
+class BrowserContext; |
+} // namespace content |
+ |
+// NetworkController wraps and tracks HttpNetworkTransactions. |
+class NetworkController |
+ : public net::HttpTransactionFactory { |
+ |
+ public: |
+ explicit NetworkController(net::HttpNetworkSession* session); |
+ virtual ~NetworkController(); |
+ |
+ void AddTransaction( |
+ uint64 transaction_id, |
+ NetworkTransaction* transaction); |
+ |
+ void RemoveTransaction(uint64 transaction_id); |
+ |
+ static void SetBlockedDomains( |
+ Profile* profile, |
+ const std::string& client_id, |
+ const std::vector<std::string>& blocked_domains); |
+ |
+ static void SetBlockedDomainsOnIO( |
+ Profile* profile, |
+ const std::string& client_id, |
+ const std::vector<std::string>& blocked_domains); |
+ |
+ void SetBlockedDomains( |
+ const std::string& client_id, |
+ const std::vector<std::string>& blocked_domains); |
+ |
+ bool IsBlockedURL(const GURL& url); |
+ |
+ // net::HttpTransactionFactory methods: |
+ virtual int CreateTransaction( |
+ net::RequestPriority priority, |
+ scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; |
+ virtual net::HttpCache* GetCache() OVERRIDE; |
+ virtual net::HttpNetworkSession* GetSession() OVERRIDE; |
+ |
+ private: |
+ scoped_ptr<net::HttpTransactionFactory> network_layer_; |
+ |
+ typedef base::hash_map<uint64, NetworkTransaction*> Transactions; |
+ Transactions transactions_; |
+ |
+ typedef std::vector<std::string> BlockedDomains; |
+ typedef base::hash_map<std::string, BlockedDomains*> BlockedDomainsMap; |
+ BlockedDomainsMap blocked_domains_map_; |
+ |
+ 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.
|
+}; |
+ |
+#endif // CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ |