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

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 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..83d730d51f24495834642a14841215f9e9676147
--- /dev/null
+++ b/chrome/browser/devtools/devtools_network_controller.h
@@ -0,0 +1,61 @@
+// 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 <set>
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+class DevToolsNetworkTransaction;
+class GURL;
+class Profile;
+
+namespace content {
+class BrowserContext;
mmenke 2014/04/21 17:16:51 This doesn't seem to be used.
eustas 2014/04/22 14:23:09 Done.
+class ResourceContext;
+} // namespace content
mmenke 2014/04/21 17:16:51 optional nit: I don't believe the close namespace
eustas 2014/04/22 14:23:09 Done.
+
+// DevToolsNetworkController tracks DevToolsNetworkTransactions.
+class DevToolsNetworkController {
+
mmenke 2014/04/21 17:16:51 nit: There's generally no linebreak here
eustas 2014/04/22 14:23:09 Done.
+ public:
+ DevToolsNetworkController();
+ virtual ~DevToolsNetworkController();
+
+ void AddTransaction(DevToolsNetworkTransaction* transaction);
+
+ void RemoveTransaction(DevToolsNetworkTransaction* transaction);
+
+ // Disables / reenables network. |id| should be DevToolsAgentHost GUID.
mmenke 2014/04/21 17:16:51 nit: id -> client_id
eustas 2014/04/22 14:23:09 Done.
+ static void DisableNetwork(
+ Profile* profile,
+ const std::string& client_id,
+ 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:
+ typedef std::set<DevToolsNetworkTransaction*> Transactions;
+ Transactions transactions_;
+
+ typedef std::set<std::string> Clients;
+ Clients clients_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController);
+};
+
+#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698