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

Unified Diff: chrome/browser/devtools/devtools_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, added unit tests Created 6 years, 8 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/devtools/devtools_network_controller.h
diff --git a/chrome/browser/devtools/devtools_network_controller.h b/chrome/browser/devtools/devtools_network_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c6f8f4b4ed8505edd791d536376b9692c900f96
--- /dev/null
+++ b/chrome/browser/devtools/devtools_network_controller.h
@@ -0,0 +1,65 @@
+// 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_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
+#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
+
+#include <string>
+
+#include "base/containers/hash_tables.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+class DevToolsNetworkTransaction;
+class GURL;
+class Profile;
+
+namespace content {
+class BrowserContext;
+class ResourceContext;
+} // namespace content
+
+// DevToolsNetworkController tracks DevToolsNetworkTransactions.
+class DevToolsNetworkController {
+
+ public:
+ DevToolsNetworkController();
+ virtual ~DevToolsNetworkController();
+
+ uint64 GenerateTransactionId();
+
+ void AddTransaction(
+ uint64 transaction_id,
+ DevToolsNetworkTransaction* transaction);
+
+ void RemoveTransaction(uint64 transaction_id);
+
+ static void DisableNetwork(
+ Profile* profile,
+ const std::string& client_id,
mmenke 2014/04/18 15:41:42 Think you need to document what a client ID is.
eustas 2014/04/21 11:34:59 Done.
+ bool disable_network);
+
+ static void DisableNetworkOnIO(
+ content::ResourceContext* resource_context,
+ const std::string& client_id,
+ bool disable_network);
+
+ void DisableNetwork(
+ const std::string& client_id,
+ bool disable_network);
+
+ bool ShouldFail(const DevToolsNetworkTransaction* transaction);
+
+ private:
+ uint64 last_transaction_id_;
+ typedef base::hash_map<uint64, DevToolsNetworkTransaction*> Transactions;
+ Transactions transactions_;
+
+ typedef base::hash_set<std::string> ClientsSet;
+ ClientsSet clients_set_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController);
+};
+
+#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698