electron/atom/browser/atom_browser_context.h

73 lines
2.5 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
#define ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
2015-07-14 19:16:13 +00:00
#include <string>
#include <vector>
2015-07-14 19:16:13 +00:00
#include "brightray/browser/browser_context.h"
namespace atom {
class AtomDownloadManagerDelegate;
2015-12-01 04:52:22 +00:00
class AtomNetworkDelegate;
class AtomPermissionManager;
2014-10-22 14:55:13 +00:00
class WebViewManager;
class AtomBrowserContext : public brightray::BrowserContext {
public:
// Get or create the BrowserContext according to its |partition| and
2016-07-12 12:53:19 +00:00
// |in_memory|. The |options| will be passed to constructor when there is no
// existing BrowserContext.
static scoped_refptr<AtomBrowserContext> From(
2016-07-12 12:53:19 +00:00
const std::string& partition, bool in_memory,
const base::DictionaryValue& options = base::DictionaryValue());
void SetUserAgent(const std::string& user_agent);
// brightray::URLRequestContextGetter::Delegate:
2015-12-01 04:52:22 +00:00
net::NetworkDelegate* CreateNetworkDelegate() override;
std::string GetUserAgent() override;
2016-05-23 01:59:39 +00:00
std::unique_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers) override;
net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path) override;
2016-05-23 01:59:39 +00:00
std::unique_ptr<net::CertVerifier> CreateCertVerifier() override;
net::SSLConfigService* CreateSSLConfigService() override;
std::vector<std::string> GetCookieableSchemes() override;
2014-10-22 14:55:13 +00:00
// content::BrowserContext:
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
2014-12-16 01:15:56 +00:00
content::BrowserPluginGuestManager* GetGuestManager() override;
content::PermissionManager* GetPermissionManager() override;
2015-07-27 01:09:32 +00:00
// brightray::BrowserContext:
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
2015-12-01 04:52:22 +00:00
AtomNetworkDelegate* network_delegate() const { return network_delegate_; }
protected:
2016-07-12 13:05:07 +00:00
AtomBrowserContext(const std::string& partition, bool in_memory,
const base::DictionaryValue& options);
~AtomBrowserContext() override;
private:
2016-05-23 01:59:39 +00:00
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
std::unique_ptr<WebViewManager> guest_manager_;
std::unique_ptr<AtomPermissionManager> permission_manager_;
2016-06-22 06:46:46 +00:00
std::string user_agent_;
2016-07-12 13:05:07 +00:00
bool use_cache_;
// Managed by brightray::BrowserContext.
2015-12-01 04:52:22 +00:00
AtomNetworkDelegate* network_delegate_;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
};
} // namespace atom
#endif // ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_