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 void AddTransaction( |
| 31 uint64 transaction_id, |
| 32 DevToolsNetworkTransaction* transaction); |
| 33 |
| 34 void RemoveTransaction(uint64 transaction_id); |
| 35 |
| 36 static void DisableNetwork( |
| 37 Profile* profile, |
| 38 const std::string& client_id, |
| 39 bool disable_network); |
| 40 |
| 41 static void DisableNetworkOnIO( |
| 42 content::ResourceContext* resourceContext, |
| 43 const std::string& client_id, |
| 44 bool disable_network); |
| 45 |
| 46 void DisableNetwork( |
| 47 const std::string& client_id, |
| 48 bool disable_network); |
| 49 |
| 50 bool IsBlockedURL(const GURL& url); |
| 51 |
| 52 private: |
| 53 typedef base::hash_map<uint64, DevToolsNetworkTransaction*> Transactions; |
| 54 Transactions transactions_; |
| 55 |
| 56 typedef base::hash_set<std::string> ClientsSet; |
| 57 ClientsSet clients_set_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController); |
| 60 }; |
| 61 |
| 62 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ |
OLD | NEW |