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

Unified 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: Split controller and factory 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698