mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-23 07:50:44 +01:00
e9bf3cdb98
This change adds basic Chrome runtime implementations for CefBrowserContext and CefBrowserPlatformDelegate. A Chrome browser window with default frame and styling can now be created using CefBrowserHost::CreateBrowser and some CefClient callbacks will be triggered via the WebContentsObserver implementation in CefBrowserHostImpl. Any additional browser windows created via the Chrome UI will be unmanaged by CEF. The application message loop will block until all browser windows have been closed by the user.
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
// Copyright 2019 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 file.
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_MAIN_EXTRA_PARTS_CEF_H_
|
|
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_MAIN_EXTRA_PARTS_CEF_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "libcef/browser/request_context_impl.h"
|
|
|
|
#include "base/macros.h"
|
|
#include "base/single_thread_task_runner.h"
|
|
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
|
|
|
// Wrapper that owns and initialize the browser memory-related extra parts.
|
|
class ChromeBrowserMainExtraPartsCef : public ChromeBrowserMainExtraParts {
|
|
public:
|
|
ChromeBrowserMainExtraPartsCef();
|
|
~ChromeBrowserMainExtraPartsCef() override;
|
|
|
|
CefRefPtr<CefRequestContextImpl> request_context() const {
|
|
return global_request_context_;
|
|
}
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner() const {
|
|
return background_task_runner_;
|
|
}
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner() const {
|
|
return user_visible_task_runner_;
|
|
}
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner()
|
|
const {
|
|
return user_blocking_task_runner_;
|
|
}
|
|
|
|
private:
|
|
// ChromeBrowserMainExtraParts overrides.
|
|
void PostProfileInit() override;
|
|
void PostMainMessageLoopRun() override;
|
|
|
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
|
|
|
// Blocking task runners exposed via CefTaskRunner. For consistency with
|
|
// previous named thread behavior always execute all pending tasks before
|
|
// shutdown (e.g. to make sure critical data is saved to disk).
|
|
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner_;
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsCef);
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_MAIN_EXTRA_PARTS_CEF_H_
|