OLD | NEW |
(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 |
| 14 class DevToolsNetworkTransaction; |
| 15 class GURL; |
| 16 class Profile; |
| 17 |
| 18 namespace content { |
| 19 class ResourceContext; |
| 20 } |
| 21 |
| 22 namespace net { |
| 23 struct HttpRequestInfo; |
| 24 } |
| 25 |
| 26 // DevToolsNetworkController tracks DevToolsNetworkTransactions. |
| 27 class DevToolsNetworkController { |
| 28 |
| 29 public: |
| 30 DevToolsNetworkController(); |
| 31 virtual ~DevToolsNetworkController(); |
| 32 |
| 33 void AddTransaction(DevToolsNetworkTransaction* transaction); |
| 34 |
| 35 void RemoveTransaction(DevToolsNetworkTransaction* transaction); |
| 36 |
| 37 // Disables / reenables network. |client_id| should be DevToolsAgentHost GUID. |
| 38 static void DisableNetwork( |
| 39 Profile* profile, |
| 40 const std::string& client_id, |
| 41 bool disable_network); |
| 42 |
| 43 static void DisableNetworkOnIO( |
| 44 content::ResourceContext* resource_context, |
| 45 const std::string& client_id, |
| 46 bool disable_network); |
| 47 |
| 48 void DisableNetwork( |
| 49 const std::string& client_id, |
| 50 bool disable_network); |
| 51 |
| 52 bool ShouldFail(const net::HttpRequestInfo* request); |
| 53 |
| 54 private: |
| 55 typedef std::set<DevToolsNetworkTransaction*> Transactions; |
| 56 Transactions transactions_; |
| 57 |
| 58 typedef std::set<std::string> Clients; |
| 59 Clients clients_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ |
OLD | NEW |