mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 01:26:03 +01:00
9484d6528c
Also perform related C++ cleanup: - Use =default instead of {} for default implementations of constructors/destructors. - Replace typedef with using.
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_
|
|
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_
|
|
#pragma once
|
|
|
|
#include "libcef/browser/browser_context.h"
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "chrome/browser/profiles/profile_manager.h"
|
|
#include "chrome/browser/profiles/profile_observer.h"
|
|
|
|
class ScopedProfileKeepAlive;
|
|
|
|
// See CefBrowserContext documentation for usage. Only accessed on the UI thread
|
|
// unless otherwise indicated.
|
|
class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
|
public:
|
|
explicit ChromeBrowserContext(const CefRequestContextSettings& settings);
|
|
|
|
ChromeBrowserContext(const ChromeBrowserContext&) = delete;
|
|
ChromeBrowserContext& operator=(const ChromeBrowserContext&) = delete;
|
|
|
|
void InitializeAsync(base::OnceClosure initialized_cb);
|
|
|
|
// CefBrowserContext overrides.
|
|
content::BrowserContext* AsBrowserContext() override;
|
|
Profile* AsProfile() override;
|
|
bool IsInitialized() const override;
|
|
void StoreOrTriggerInitCallback(base::OnceClosure callback) override;
|
|
void Shutdown() override;
|
|
|
|
// ProfileObserver overrides.
|
|
void OnProfileWillBeDestroyed(Profile* profile) override;
|
|
|
|
private:
|
|
~ChromeBrowserContext() override;
|
|
|
|
void ProfileCreated(Profile* profile, Profile::CreateStatus status);
|
|
|
|
base::OnceClosure initialized_cb_;
|
|
Profile* profile_ = nullptr;
|
|
bool should_destroy_ = false;
|
|
|
|
bool destroyed_ = false;
|
|
std::unique_ptr<ScopedProfileKeepAlive> profile_keep_alive_;
|
|
|
|
std::vector<base::OnceClosure> init_callbacks_;
|
|
|
|
base::WeakPtrFactory<ChromeBrowserContext> weak_ptr_factory_;
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_CONTEXT_H_
|