Chromium Code Reviews| 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..2c6f8f4b4ed8505edd791d536376b9692c900f96 |
| --- /dev/null |
| +++ b/chrome/browser/devtools/devtools_network_controller.h |
| @@ -0,0 +1,65 @@ |
| +// 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 <string> |
| + |
| +#include "base/containers/hash_tables.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +class DevToolsNetworkTransaction; |
| +class GURL; |
| +class Profile; |
| + |
| +namespace content { |
| +class BrowserContext; |
| +class ResourceContext; |
| +} // namespace content |
| + |
| +// DevToolsNetworkController tracks DevToolsNetworkTransactions. |
| +class DevToolsNetworkController { |
| + |
| + public: |
| + DevToolsNetworkController(); |
| + virtual ~DevToolsNetworkController(); |
| + |
| + uint64 GenerateTransactionId(); |
| + |
| + void AddTransaction( |
| + uint64 transaction_id, |
| + DevToolsNetworkTransaction* transaction); |
| + |
| + void RemoveTransaction(uint64 transaction_id); |
| + |
| + static void DisableNetwork( |
| + Profile* profile, |
| + 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.
|
| + 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: |
| + uint64 last_transaction_id_; |
| + typedef base::hash_map<uint64, DevToolsNetworkTransaction*> Transactions; |
| + Transactions transactions_; |
| + |
| + typedef base::hash_set<std::string> ClientsSet; |
| + ClientsSet clients_set_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_ |