2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2011 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.
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2024-04-23 22:06:00 +02:00
|
|
|
#include <string_view>
|
|
|
|
|
2021-08-09 23:18:43 +02:00
|
|
|
#include "base/command_line.h"
|
2024-05-11 17:48:38 +02:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "build/build_config.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/libcef/browser/request_context_impl.h"
|
2016-02-05 01:49:19 +01:00
|
|
|
#include "components/prefs/pref_service.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "content/public/browser/browser_main_parts.h"
|
2022-06-17 15:28:55 +02:00
|
|
|
#include "ui/display/screen.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-04-26 18:49:30 +02:00
|
|
|
#if defined(USE_AURA)
|
|
|
|
namespace wm {
|
|
|
|
class WMState;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-10-15 13:11:59 +02:00
|
|
|
namespace views {
|
|
|
|
class ViewsDelegate;
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2019-10-15 13:11:59 +02:00
|
|
|
class LayoutProvider;
|
|
|
|
#endif
|
2020-06-28 20:29:44 +02:00
|
|
|
} // namespace views
|
2019-10-15 13:11:59 +02:00
|
|
|
|
2022-09-26 21:30:45 +02:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
|
|
namespace ui {
|
|
|
|
class LinuxUiGetter;
|
2024-03-29 17:48:33 +01:00
|
|
|
#if defined(USE_DBUS)
|
|
|
|
class DarkModeManagerLinux;
|
|
|
|
#endif
|
|
|
|
} // namespace ui
|
2022-09-26 21:30:45 +02:00
|
|
|
#endif
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
class CefDevToolsDelegate;
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
class AlloyBrowserMainParts : public content::BrowserMainParts {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2022-05-19 12:28:44 +02:00
|
|
|
AlloyBrowserMainParts();
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
AlloyBrowserMainParts(const AlloyBrowserMainParts&) = delete;
|
|
|
|
AlloyBrowserMainParts& operator=(const AlloyBrowserMainParts&) = delete;
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
~AlloyBrowserMainParts() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
|
|
|
|
void ToolkitInitialized() override;
|
2021-06-04 03:34:56 +02:00
|
|
|
void PreCreateMainMessageLoop() override;
|
|
|
|
void PostCreateMainMessageLoop() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
int PreCreateThreads() override;
|
2023-12-05 00:45:54 +01:00
|
|
|
void PostCreateThreads() override;
|
2021-04-21 00:52:34 +02:00
|
|
|
int PreMainMessageLoopRun() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void PostMainMessageLoopRun() override;
|
|
|
|
void PostDestroyThreads() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context() const {
|
|
|
|
return global_request_context_;
|
2013-09-03 18:43:31 +02:00
|
|
|
}
|
2017-05-17 11:29:28 +02:00
|
|
|
CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; }
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-03-20 21:15:08 +01:00
|
|
|
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_;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
private:
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2012-04-03 03:34:16 +02:00
|
|
|
void PlatformInitialize();
|
2022-01-24 18:58:02 +01:00
|
|
|
#endif // BUILDFLAG(IS_WIN)
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
2024-05-11 17:48:38 +02:00
|
|
|
raw_ptr<CefDevToolsDelegate> devtools_delegate_ = nullptr; // Deletes itself.
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-03-20 21:15:08 +01:00
|
|
|
// 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).
|
|
|
|
// |background_task_runner_| is also passed to SQLitePersistentCookieStore.
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner_;
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
|
|
|
|
|
2017-04-26 18:49:30 +02:00
|
|
|
#if defined(USE_AURA)
|
2021-06-04 03:34:56 +02:00
|
|
|
std::unique_ptr<display::Screen> screen_;
|
2017-04-26 18:49:30 +02:00
|
|
|
std::unique_ptr<wm::WMState> wm_state_;
|
|
|
|
#endif
|
|
|
|
|
2019-10-15 13:11:59 +02:00
|
|
|
std::unique_ptr<views::ViewsDelegate> views_delegate_;
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2022-06-17 15:28:55 +02:00
|
|
|
std::unique_ptr<display::ScopedNativeScreen> screen_;
|
2019-10-15 13:11:59 +02:00
|
|
|
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
|
|
|
#endif
|
2022-09-26 21:30:45 +02:00
|
|
|
|
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
|
|
std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
|
2024-03-29 17:48:33 +01:00
|
|
|
#if defined(USE_DBUS)
|
|
|
|
std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
|
|
|
|
#endif
|
2022-09-26 21:30:45 +02:00
|
|
|
#endif
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_
|