refactor: add ElectronBrowserContext::GetDefaultBrowserContext()
(#46086)
* refactor: add ElectronBrowserContext::DestroyAllContexts() Simpler semantics than previous implementation; also hides the "default context must be destroyed last" implementation detail. Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: add ElectronBrowserContext::GetDefaultBrowserContext() clearer semantics than everyone calling From("", false) Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
bc9389df9a
commit
7ea2daf456
8 changed files with 26 additions and 11 deletions
|
@ -84,6 +84,10 @@ class ElectronBrowserContext : public content::BrowserContext {
|
|||
using BrowserContextMap =
|
||||
std::map<PartitionKey, std::unique_ptr<ElectronBrowserContext>>;
|
||||
|
||||
// Get or create the default BrowserContext.
|
||||
static ElectronBrowserContext* GetDefaultBrowserContext(
|
||||
base::Value::Dict options = {});
|
||||
|
||||
// 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.
|
||||
|
@ -99,6 +103,8 @@ class ElectronBrowserContext : public content::BrowserContext {
|
|||
|
||||
static BrowserContextMap& browser_context_map();
|
||||
|
||||
static void DestroyAllContexts();
|
||||
|
||||
void SetUserAgent(const std::string& user_agent);
|
||||
std::string GetUserAgent() const;
|
||||
bool can_use_http_cache() const { return use_cache_; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue