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
|
|
|
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "base/macros.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"
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
struct MainFunctionParams;
|
|
|
|
}
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
namespace extensions {
|
|
|
|
class ExtensionsBrowserClient;
|
|
|
|
class ExtensionsClient;
|
2017-07-27 01:19:27 +02:00
|
|
|
} // namespace extensions
|
2015-07-16 23:40:01 +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
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
|
|
namespace views {
|
|
|
|
class ViewsDelegate;
|
2020-08-29 00:39:23 +02:00
|
|
|
#if defined(OS_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:
|
2020-06-28 20:29:44 +02:00
|
|
|
explicit AlloyBrowserMainParts(const content::MainFunctionParams& parameters);
|
|
|
|
~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;
|
2018-03-20 21:15:08 +01:00
|
|
|
void PreMainMessageLoopStart() override;
|
|
|
|
void PostMainMessageLoopStart() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
int PreCreateThreads() override;
|
|
|
|
void PreMainMessageLoopRun() override;
|
|
|
|
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:
|
2015-06-12 00:08:33 +02:00
|
|
|
#if defined(OS_WIN)
|
2012-04-03 03:34:16 +02:00
|
|
|
void PlatformInitialize();
|
2015-06-12 00:08:33 +02:00
|
|
|
#endif // defined(OS_WIN)
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
2014-12-13 21:18:31 +01:00
|
|
|
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
2017-05-17 11:29:28 +02:00
|
|
|
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
|
|
|
extensions_browser_client_;
|
2015-07-16 23:40:01 +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)
|
|
|
|
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_;
|
2020-08-29 00:39:23 +02:00
|
|
|
#if defined(OS_MAC)
|
2019-10-15 13:11:59 +02:00
|
|
|
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
|
|
|
#endif
|
|
|
|
#endif // defined(TOOLKIT_VIEWS)
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(AlloyBrowserMainParts);
|
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_
|