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
|
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
#include "libcef/browser/request_context_impl.h"
|
2013-02-06 21:41:54 +01:00
|
|
|
|
2021-08-09 23:18:43 +02:00
|
|
|
#include "base/command_line.h"
|
2013-04-16 00:16:01 +02:00
|
|
|
#include "base/strings/string_piece.h"
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "build/build_config.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"
|
2021-12-16 23:35:54 +01:00
|
|
|
#include "content/public/common/main_function_params.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-04-26 18:49:30 +02:00
|
|
|
#if defined(USE_AURA)
|
2021-06-04 03:34:56 +02:00
|
|
|
namespace display {
|
|
|
|
class Screen;
|
|
|
|
}
|
2017-04-26 18:49:30 +02:00
|
|
|
namespace wm {
|
|
|
|
class WMState;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-10-15 13:11:59 +02:00
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
|
|
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
|
|
|
#endif // defined(TOOLKIT_VIEWS)
|
|
|
|
|
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:
|
2021-12-16 23:35:54 +01:00
|
|
|
explicit AlloyBrowserMainParts(content::MainFunctionParams parameters);
|
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
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
int PreEarlyInitialization() 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;
|
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
|
|
|
|
2021-12-16 23:35:54 +01:00
|
|
|
content::MainFunctionParams parameters_;
|
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
2021-12-16 23:35:54 +01:00
|
|
|
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
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
|
|
std::unique_ptr<views::ViewsDelegate> views_delegate_;
|
2022-01-24 18:58:02 +01:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2019-10-15 13:11:59 +02:00
|
|
|
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
|
|
|
#endif
|
|
|
|
#endif // defined(TOOLKIT_VIEWS)
|
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_
|