Chromium Code Reviews| 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 <string> | |
| 9 | |
| 10 #include "base/containers/hash_tables.h" | |
| 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 BrowserContext; | |
| 20 class ResourceContext; | |
| 21 } // namespace content | |
| 22 | |
| 23 // DevToolsNetworkController tracks DevToolsNetworkTransactions. | |
| 24 class DevToolsNetworkController { | |
| 25 | |
| 26 public: | |
| 27 DevToolsNetworkController(); | |
| 28 virtual ~DevToolsNetworkController(); | |
| 29 | |
| 30 uint64 GenerateTransactionId(); | |
| 31 | |
| 32 void AddTransaction( | |
| 33 uint64 transaction_id, | |
| 34 DevToolsNetworkTransaction* transaction); | |
| 35 | |
| 36 void RemoveTransaction(uint64 transaction_id); | |
| 37 | |
| 38 static void DisableNetwork( | |
| 39 Profile* profile, | |
| 40 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.
| |
| 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 DevToolsNetworkTransaction* transaction); | |
| 53 | |
| 54 private: | |
| 55 uint64 last_transaction_id_; | |
| 56 typedef base::hash_map<uint64, DevToolsNetworkTransaction*> Transactions; | |
| 57 Transactions transactions_; | |
| 58 | |
| 59 typedef base::hash_set<std::string> ClientsSet; | |
| 60 ClientsSet clients_set_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController); | |
| 63 }; | |
| 64 | |
| 65 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ | |
| OLD | NEW |