d663b4eaee
* chore: fix cpplint 'include_what_you_use' warnings Typically by including <memory>, <utility> etc. * chore: fix 'static/global string constant' warning Use C style strings instead of std::string. Style guide forbids non-trivial static / global variables. https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables /home/charles/electron/electron-gn/src/electron/script/cpplint.js * refactor: remove global string variables. Fix 'global string variables are not permitted' linter warnings by using the base::NoDestructor<> wrapper to make it explicit that these variables are never destroyed. The style guide's take on globals with nontrivial destructors: https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables * fix: initializer error introduced in last commit * fix: remove WIP file that was included by accident * fix: include order * fix: include order * fix: include order * fix: include order, again
79 lines
2.5 KiB
C++
79 lines
2.5 KiB
C++
// Copyright (c) 2013 GitHub, Inc.
|
|
// 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_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/memory/scoped_refptr.h"
|
|
#include "brightray/browser/browser_context.h"
|
|
|
|
namespace storage {
|
|
class SpecialStoragePolicy;
|
|
}
|
|
|
|
namespace atom {
|
|
|
|
class AtomBlobReader;
|
|
class AtomDownloadManagerDelegate;
|
|
class AtomPermissionManager;
|
|
class RequestContextDelegate;
|
|
class SpecialStoragePolicy;
|
|
class WebViewManager;
|
|
|
|
class AtomBrowserContext : public brightray::BrowserContext {
|
|
public:
|
|
// Get or create the BrowserContext according to its |partition| and
|
|
// |in_memory|. The |options| will be passed to constructor when there is no
|
|
// existing BrowserContext.
|
|
static scoped_refptr<AtomBrowserContext> From(
|
|
const std::string& partition,
|
|
bool in_memory,
|
|
const base::DictionaryValue& options = base::DictionaryValue());
|
|
|
|
void SetUserAgent(const std::string& user_agent);
|
|
AtomBlobReader* GetBlobReader();
|
|
|
|
// content::BrowserContext:
|
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
|
content::PermissionManager* GetPermissionManager() override;
|
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
|
|
|
// brightray::BrowserContext:
|
|
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
|
std::string GetUserAgent() const override;
|
|
void OnMainRequestContextCreated(
|
|
brightray::URLRequestContextGetter* getter) override;
|
|
|
|
RequestContextDelegate* GetRequestContextDelegate() const {
|
|
return request_context_delegate_.get();
|
|
}
|
|
|
|
protected:
|
|
AtomBrowserContext(const std::string& partition,
|
|
bool in_memory,
|
|
const base::DictionaryValue& options);
|
|
~AtomBrowserContext() override;
|
|
|
|
private:
|
|
brightray::URLRequestContextGetter* url_request_context_getter_;
|
|
|
|
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
|
|
std::unique_ptr<WebViewManager> guest_manager_;
|
|
std::unique_ptr<AtomPermissionManager> permission_manager_;
|
|
scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
|
|
std::unique_ptr<AtomBlobReader> blob_reader_;
|
|
std::unique_ptr<RequestContextDelegate> request_context_delegate_;
|
|
std::string user_agent_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
|
|
};
|
|
|
|
} // namespace atom
|
|
|
|
#endif // ATOM_BROWSER_ATOM_BROWSER_CONTEXT_H_
|