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

Side by Side 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: Rebase Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h"
15
16 class DevToolsNetworkTransaction;
17 class GURL;
18 class Profile;
19
20 namespace content {
21 class ResourceContext;
22 }
23
24 namespace net {
25 struct HttpRequestInfo;
26 }
27
28 namespace test {
29 class DevToolsNetworkControllerHelper;
30 }
31
32 // DevToolsNetworkController tracks DevToolsNetworkTransactions.
33 class DevToolsNetworkController {
34
35 public:
36 DevToolsNetworkController();
37 virtual ~DevToolsNetworkController();
38
39 void AddTransaction(DevToolsNetworkTransaction* transaction);
40
41 void RemoveTransaction(DevToolsNetworkTransaction* transaction);
42
43 // Applies network emulation configuration.
44 // |client_id| should be DevToolsAgentHost GUID.
45 void SetNetworkState(
46 const std::string& client_id,
47 bool disable_network);
48
49 bool ShouldFail(const net::HttpRequestInfo* request);
50
51 protected:
52 friend class test::DevToolsNetworkControllerHelper;
53
54 private:
55 // Controller must be constructed on IO thread.
56 base::ThreadChecker thread_checker_;
57
58 void SetNetworkStateOnIO(
59 const std::string& client_id,
60 bool disable_network);
61
62 typedef std::set<DevToolsNetworkTransaction*> Transactions;
63 Transactions transactions_;
64
65 typedef std::set<std::string> Clients;
66 Clients clients_;
67
68 base::WeakPtrFactory<DevToolsNetworkController> weak_ptr_factory_;
69
70 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController);
71 };
72
73 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/devtools/chrome_devtools_manager_delegate.cc ('k') | chrome/browser/devtools/devtools_network_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698