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..57942520c98eb2546d099f4cd33d22e230365f20 |
--- /dev/null |
+++ b/chrome/browser/net/network_controller.h |
@@ -0,0 +1,62 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// 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_ |
+ |
+#include <string> |
+ |
+#include "base/containers/hash_tables.h" |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+ |
+class NetworkTransaction; |
+class GURL; |
+class Profile; |
+ |
+namespace content { |
+class BrowserContext; |
+class ResourceContext; |
+} // namespace content |
+ |
+// NetworkController tracks NetworkTransactions. |
+class NetworkController { |
+ |
+ public: |
+ NetworkController(); |
+ virtual ~NetworkController(); |
+ |
+ void AddTransaction( |
+ uint64 transaction_id, |
+ NetworkTransaction* transaction); |
+ |
+ void RemoveTransaction(uint64 transaction_id); |
+ |
+ static void DisableNetwork( |
+ Profile* profile, |
+ const std::string& client_id, |
+ bool disable_network); |
+ |
+ static void DisableNetworkOnIO( |
+ content::ResourceContext* resourceContext, |
+ const std::string& client_id, |
+ bool disable_network); |
+ |
+ void DisableNetwork( |
+ const std::string& client_id, |
+ bool disable_network); |
+ |
+ bool IsBlockedURL(const GURL& url); |
+ |
+ private: |
+ typedef base::hash_map<uint64, NetworkTransaction*> Transactions; |
+ Transactions transactions_; |
+ |
+ typedef base::hash_set<std::string> ClientsSet; |
+ ClientsSet clients_set_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NetworkController); |
+}; |
+ |
+#endif // CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_ |