electron/brightray/browser/url_request_context_getter.h

73 lines
2.3 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 "base/callback.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"
#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;
class ProxyConfigService;
class URLRequestContextStorage;
}
namespace brightray {
class NetworkDelegate;
typedef base::Callback<scoped_ptr<net::URLRequestJobFactory>(
content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector* protocol_interceptors)> URLRequestJobFactoryFactory;
2013-03-13 19:12:05 +00:00
class URLRequestContextGetter : public net::URLRequestContextGetter {
public:
2013-03-13 19:12:05 +00:00
URLRequestContextGetter(
const base::FilePath& base_path,
base::MessageLoop* io_loop,
base::MessageLoop* file_loop,
base::Callback<scoped_ptr<NetworkDelegate>(void)>,
URLRequestJobFactoryFactory job_factory_factory,
content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors);
2013-03-13 19:12:05 +00:00
virtual ~URLRequestContextGetter();
net::HostResolver* host_resolver();
virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
private:
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetNetworkTaskRunner() const OVERRIDE;
2013-03-13 19:12:05 +00:00
base::FilePath base_path_;
base::MessageLoop* io_loop_;
base::MessageLoop* file_loop_;
2013-03-13 19:12:05 +00:00
base::Callback<scoped_ptr<NetworkDelegate>(void)> network_delegate_factory_;
URLRequestJobFactoryFactory job_factory_factory_;
2013-03-13 19:12:05 +00:00
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
scoped_ptr<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_;
2013-03-13 19:12:05 +00:00
content::ProtocolHandlerMap protocol_handlers_;
content::ProtocolHandlerScopedVector protocol_interceptors_;
2013-03-13 19:12:05 +00:00
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
};
} // namespace brightray
2013-03-13 19:12:05 +00:00
#endif