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.
|
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#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 "base/files/file_path.h"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
|
|
|
#include "content/public/browser/content_browser_client.h"
|
2015-01-05 21:29:16 +00:00
|
|
|
#include "net/http/http_cache.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"
|
|
|
|
|
2013-04-18 03:27:53 +00:00
|
|
|
namespace base {
|
2013-03-13 19:12:05 +00:00
|
|
|
class MessageLoop;
|
2013-04-18 03:27:53 +00:00
|
|
|
}
|
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;
|
2014-08-20 06:39:09 +00:00
|
|
|
class NetworkDelegate;
|
2013-03-13 19:12:05 +00:00
|
|
|
class ProxyConfigService;
|
|
|
|
class URLRequestContextStorage;
|
2014-08-20 06:39:09 +00:00
|
|
|
class URLRequestJobFactory;
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
2015-09-26 18:19:27 +00:00
|
|
|
class DevToolsNetworkController;
|
2015-08-11 10:29:55 +00:00
|
|
|
class NetLog;
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
class URLRequestContextGetter : public net::URLRequestContextGetter {
|
2013-11-17 23:43:46 +00:00
|
|
|
public:
|
2014-08-20 06:39:09 +00:00
|
|
|
class Delegate {
|
|
|
|
public:
|
2015-10-19 19:51:01 +00:00
|
|
|
Delegate();
|
2014-08-20 06:39:09 +00:00
|
|
|
virtual ~Delegate() {}
|
|
|
|
|
2014-08-20 06:48:02 +00:00
|
|
|
virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; }
|
2015-07-14 17:04:34 +00:00
|
|
|
virtual std::string GetUserAgent();
|
2015-12-07 11:55:01 +00:00
|
|
|
virtual scoped_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
|
2014-08-20 06:39:09 +00:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-08-31 10:43:01 +00:00
|
|
|
content::URLRequestInterceptorScopedVector* protocol_interceptors);
|
2015-01-05 21:29:16 +00:00
|
|
|
virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
|
|
|
|
const base::FilePath& base_path);
|
2015-12-07 11:55:01 +00:00
|
|
|
virtual scoped_ptr<net::CertVerifier> CreateCertVerifier();
|
2015-09-21 16:44:32 +00:00
|
|
|
virtual net::SSLConfigService* CreateSSLConfigService();
|
2015-10-19 19:51:01 +00:00
|
|
|
virtual bool AllowNTLMCredentialsForDomain(const GURL& auth_origin);
|
|
|
|
virtual bool CanDelegateURLSecurity(const GURL& auth_origin);
|
2015-11-05 15:26:46 +00:00
|
|
|
|
2015-10-19 19:51:01 +00:00
|
|
|
private:
|
|
|
|
scoped_ptr<net::URLSecurityManager> orig_url_sec_mgr_;
|
|
|
|
};
|
2015-11-05 15:26:46 +00:00
|
|
|
|
2015-10-19 19:51:01 +00:00
|
|
|
class DelegateURLSecurityManager : public net::URLSecurityManager {
|
|
|
|
public:
|
|
|
|
DelegateURLSecurityManager(URLRequestContextGetter::Delegate* delegate);
|
|
|
|
|
|
|
|
bool CanUseDefaultCredentials(const GURL& auth_origin) const override;
|
|
|
|
bool CanDelegate(const GURL& auth_origin) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
URLRequestContextGetter::Delegate* delegate_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DelegateURLSecurityManager);
|
2014-08-20 06:39:09 +00:00
|
|
|
};
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
URLRequestContextGetter(
|
2014-08-20 06:39:09 +00:00
|
|
|
Delegate* delegate,
|
2015-09-26 18:19:27 +00:00
|
|
|
DevToolsNetworkController* controller,
|
2015-08-11 10:29:55 +00:00
|
|
|
NetLog* net_log,
|
2013-03-13 19:12:05 +00:00
|
|
|
const base::FilePath& base_path,
|
2015-08-26 21:40:02 +00:00
|
|
|
bool in_memory,
|
2013-04-18 03:27:53 +00:00
|
|
|
base::MessageLoop* io_loop,
|
|
|
|
base::MessageLoop* file_loop,
|
2014-06-26 20:27:22 +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
|
|
|
virtual ~URLRequestContextGetter();
|
|
|
|
|
2014-08-20 07:19:25 +00:00
|
|
|
// 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
|
|
|
|
2014-08-20 07:19:25 +00:00
|
|
|
net::HostResolver* host_resolver();
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2014-08-20 07:19:25 +00:00
|
|
|
private:
|
2014-08-20 06:39:09 +00:00
|
|
|
Delegate* delegate_;
|
|
|
|
|
2015-09-26 18:19:27 +00:00
|
|
|
DevToolsNetworkController* controller_;
|
2015-08-11 10:29:55 +00:00
|
|
|
NetLog* net_log_;
|
2013-03-13 19:12:05 +00:00
|
|
|
base::FilePath base_path_;
|
2015-08-26 21:40:02 +00:00
|
|
|
bool in_memory_;
|
2013-04-18 03:27:53 +00:00
|
|
|
base::MessageLoop* io_loop_;
|
|
|
|
base::MessageLoop* file_loop_;
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
|
2014-08-20 06:39:09 +00:00
|
|
|
scoped_ptr<net::NetworkDelegate> network_delegate_;
|
2013-03-13 19:12:05 +00:00
|
|
|
scoped_ptr<net::URLRequestContextStorage> storage_;
|
|
|
|
scoped_ptr<net::URLRequestContext> url_request_context_;
|
2014-08-15 04:30:50 +00:00
|
|
|
scoped_ptr<net::HostMappingRules> host_mapping_rules_;
|
2015-10-19 19:51:01 +00:00
|
|
|
scoped_ptr<net::URLSecurityManager> url_sec_mgr_;
|
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
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
|
|
|
|
};
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#endif
|