electron/brightray/browser/url_request_context_getter.h

111 lines
3.6 KiB
C
Raw Normal View History

2013-03-13 19:12:05 +00:00
// Copyright (c) 2012 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-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_
#define BRIGHTRAY_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_
2013-03-13 19:12:05 +00:00
#include <string>
#include <vector>
2013-03-13 19:12:05 +00:00
#include "base/files/file_path.h"
#include "content/public/browser/browser_context.h"
2013-03-13 19:12:05 +00:00
#include "content/public/browser/content_browser_client.h"
2016-09-21 16:09:43 +00:00
#include "net/cookies/cookie_monster.h"
2015-01-05 21:29:16 +00:00
#include "net/http/http_cache.h"
#include "net/http/transport_security_state.h"
2015-05-06 05:35:48 +00:00
#include "net/http/url_security_manager.h"
2013-03-13 19:12:05 +00:00
#include "net/url_request/url_request_context_getter.h"
namespace base {
2013-03-13 19:12:05 +00:00
class MessageLoop;
}
2013-03-13 19:12:05 +00:00
namespace net {
2014-08-15 04:30:50 +00:00
class HostMappingRules;
2013-03-13 19:12:05 +00:00
class HostResolver;
2016-03-08 11:59:29 +00:00
class HttpAuthPreferences;
class NetworkDelegate;
2013-03-13 19:12:05 +00:00
class ProxyConfigService;
class URLRequestContextStorage;
class URLRequestJobFactory;
2013-03-13 19:12:05 +00:00
}
namespace brightray {
class RequireCTDelegate;
class DevToolsNetworkControllerHandle;
2015-08-11 10:29:55 +00:00
class NetLog;
2013-03-13 19:12:05 +00:00
class URLRequestContextGetter : public net::URLRequestContextGetter {
public:
class Delegate {
public:
Delegate() {}
virtual ~Delegate() {}
2016-09-21 16:09:43 +00:00
virtual net::NetworkDelegate* CreateNetworkDelegate() { return nullptr; }
virtual net::CookieMonsterDelegate* CreateCookieDelegate() {
return nullptr;
}
virtual std::string GetUserAgent();
virtual std::unique_ptr<net::URLRequestJobFactory>
CreateURLRequestJobFactory(content::ProtocolHandlerMap* protocol_handlers);
2015-01-05 21:29:16 +00:00
virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path);
virtual std::unique_ptr<net::CertVerifier> CreateCertVerifier(
RequireCTDelegate* ct_delegate);
virtual net::SSLConfigService* CreateSSLConfigService();
virtual std::vector<std::string> GetCookieableSchemes();
};
2013-03-13 19:12:05 +00:00
URLRequestContextGetter(
Delegate* delegate,
DevToolsNetworkControllerHandle* handle,
2015-08-11 10:29:55 +00:00
NetLog* net_log,
2013-03-13 19:12:05 +00:00
const base::FilePath& base_path,
bool in_memory,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
content::ProtocolHandlerMap* protocol_handlers,
2014-08-31 10:43:01 +00:00
content::URLRequestInterceptorScopedVector protocol_interceptors);
2013-03-13 19:12:05 +00:00
virtual ~URLRequestContextGetter();
// net::URLRequestContextGetter:
2015-06-05 04:07:27 +00:00
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
const override;
2013-03-13 19:12:05 +00:00
net::HostResolver* host_resolver();
net::URLRequestJobFactory* job_factory() const { return job_factory_; }
2013-03-13 19:12:05 +00:00
private:
Delegate* delegate_;
DevToolsNetworkControllerHandle* network_controller_handle_;
2015-08-11 10:29:55 +00:00
NetLog* net_log_;
2013-03-13 19:12:05 +00:00
base::FilePath base_path_;
bool in_memory_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
2013-03-13 19:12:05 +00:00
2016-06-22 06:52:04 +00:00
std::string user_agent_;
std::unique_ptr<RequireCTDelegate> ct_delegate_;
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
std::unique_ptr<net::NetworkDelegate> network_delegate_;
std::unique_ptr<net::URLRequestContextStorage> storage_;
std::unique_ptr<net::URLRequestContext> url_request_context_;
std::unique_ptr<net::HostMappingRules> host_mapping_rules_;
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
std::unique_ptr<net::HttpNetworkSession> http_network_session_;
2013-03-13 19:12:05 +00:00
content::ProtocolHandlerMap protocol_handlers_;
2014-08-31 10:43:01 +00:00
content::URLRequestInterceptorScopedVector protocol_interceptors_;
2013-03-13 19:12:05 +00:00
net::URLRequestJobFactory* job_factory_; // weak ref
2013-03-13 19:12:05 +00:00
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
};
} // namespace brightray
2013-03-13 19:12:05 +00:00
#endif // BRIGHTRAY_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_