| Index: chrome/browser/net/network_controller.h
|
| diff --git a/chrome/browser/net/network_controller.h b/chrome/browser/net/network_controller.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e0edecbd2d6045d7f595d3db64a945523a1aca0c
|
| --- /dev/null
|
| +++ b/chrome/browser/net/network_controller.h
|
| @@ -0,0 +1,82 @@
|
| +// 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_NET_NETWORK_CONTROLLER_H_
|
| +#define CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/containers/hash_tables.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "net/base/request_priority.h"
|
| +#include "net/http/http_transaction_factory.h"
|
| +
|
| +class NetworkTransaction;
|
| +class GURL;
|
| +class Profile;
|
| +
|
| +namespace net {
|
| +class HttpCache;
|
| +class HttpNetworkSession;
|
| +class HttpTransaction;
|
| +} // namespace net
|
| +
|
| +namespace content {
|
| +class BrowserContext;
|
| +class ResourceContext;
|
| +} // namespace content
|
| +
|
| +// NetworkController wraps and tracks HttpNetworkTransactions.
|
| +class NetworkController
|
| + : public net::HttpTransactionFactory {
|
| +
|
| + public:
|
| + explicit NetworkController(net::HttpNetworkSession* session);
|
| + virtual ~NetworkController();
|
| +
|
| + void AddTransaction(
|
| + uint64 transaction_id,
|
| + NetworkTransaction* transaction);
|
| +
|
| + void RemoveTransaction(uint64 transaction_id);
|
| +
|
| + static void SetBlockedDomains(
|
| + Profile* profile,
|
| + const std::string& client_id,
|
| + const std::vector<std::string>& blocked_domains);
|
| +
|
| + static void SetBlockedDomainsOnIO(
|
| + content::ResourceContext* resourceContext,
|
| + const std::string& client_id,
|
| + const std::vector<std::string>& blocked_domains);
|
| +
|
| + void SetBlockedDomains(
|
| + const std::string& client_id,
|
| + const std::vector<std::string>& blocked_domains);
|
| +
|
| + bool IsBlockedURL(const GURL& url);
|
| +
|
| + // net::HttpTransactionFactory methods:
|
| + virtual int CreateTransaction(
|
| + net::RequestPriority priority,
|
| + scoped_ptr<net::HttpTransaction>* trans) OVERRIDE;
|
| + virtual net::HttpCache* GetCache() OVERRIDE;
|
| + virtual net::HttpNetworkSession* GetSession() OVERRIDE;
|
| +
|
| + private:
|
| + scoped_ptr<net::HttpTransactionFactory> network_layer_;
|
| +
|
| + typedef base::hash_map<uint64, NetworkTransaction*> Transactions;
|
| + Transactions transactions_;
|
| +
|
| + typedef std::vector<std::string> BlockedDomains;
|
| + typedef base::hash_map<std::string, BlockedDomains*> BlockedDomainsMap;
|
| + BlockedDomainsMap blocked_domains_map_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetworkController);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_NET_NETWORK_CONTROLLER_H_
|
|
|