![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump chromium in DEPS to 141.0.7341.0 * chore: bump chromium in DEPS to 141.0.7342.0 * chore: update patches manually resolved conflict in `osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch` due to https://crrev.com/c/6681354 * 6819541: WebShare: Improve mac share behavior when sharing a URL https://chromium-review.googlesource.com/c/chromium/src/+/6819541 * Add missing include for SkBitmap Couldn't quickly find where we lost the full definition in this file's includes. 🤷 * 6771055: [SxS] Move devtools to ContentsContainerView supporting side-by-side. https://chromium-review.googlesource.com/c/chromium/src/+/6771055 There may be some simplification possible here (set_x, Rect position, ...), but this change is satisfactory to maintain the current behavior. * 6813689: Switch SystemMemoryInfoKB to use ByteCount https://chromium-review.googlesource.com/c/chromium/src/+/6813689 * 6818486: Track DevTools feature usage in new badge tracker https://chromium-review.googlesource.com/c/chromium/src/+/6818486 * chore: bump chromium in DEPS to 141.0.7344.0 * Remove ELECTRON_OZONE_PLATFORM_HINT env var 6819616: Remove OzonePlatformHint | https://chromium-review.googlesource.com/c/chromium/src/+/6819616 See: https://github.com/electron/electron/issues/48001 * chore: update patches * Add missing include for `base::NumberToString` * Remove `DESKTOP_STARTUP_ID` code This was removed upstream in https://chromium-review.googlesource.com/c/chromium/src/+/6819616 and I confirmed with the author that it was an intentional change. Going to mirror upstream and remove it here too. * chore: bump chromium in DEPS to 141.0.7346.0 * chore: update patches * 6828465: Reland "Remove BluezDBusThreadManager" https://chromium-review.googlesource.com/c/chromium/src/+/6828465 * Patch change to Node.js test output V8 enhanced the stack trace of "thenable" async tasks. A couple of Node.js tests needed to have their snapshots updates to accomodate the extra stack trace frames in the output. This patch should be upstreamed to Node.js. See: 6826001: fix thenable async stack trace https://chromium-review.googlesource.com/c/v8/v8/+/6826001 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org>
192 lines
5 KiB
C++
192 lines
5 KiB
C++
// Copyright (c) 2013 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
|
#define ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
#include "base/functional/callback_forward.h"
|
|
#include "base/task/single_thread_task_runner.h"
|
|
#include "content/public/browser/browser_main_parts.h"
|
|
#include "electron/buildflags/buildflags.h"
|
|
#include "mojo/public/cpp/bindings/remote.h"
|
|
#include "services/device/public/mojom/geolocation_control.mojom.h"
|
|
|
|
class BrowserProcessImpl;
|
|
class IconManager;
|
|
|
|
namespace base {
|
|
class FieldTrialList;
|
|
}
|
|
|
|
namespace display {
|
|
class Screen;
|
|
class ScopedNativeScreen;
|
|
} // namespace display
|
|
|
|
#if defined(USE_AURA)
|
|
namespace wm {
|
|
class WMState;
|
|
}
|
|
|
|
namespace display {
|
|
class Screen;
|
|
}
|
|
#endif
|
|
|
|
namespace node {
|
|
class Environment;
|
|
}
|
|
|
|
namespace ui {
|
|
class LinuxUiGetter;
|
|
class DarkModeManagerLinux;
|
|
} // namespace ui
|
|
|
|
namespace views {
|
|
class LayoutProvider;
|
|
} // namespace views
|
|
|
|
namespace electron {
|
|
|
|
class Browser;
|
|
class ElectronBindings;
|
|
class JavascriptEnvironment;
|
|
class NodeBindings;
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
class ElectronExtensionsClient;
|
|
class ElectronExtensionsBrowserClient;
|
|
#endif
|
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
class ViewsDelegate;
|
|
#endif
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
class ViewsDelegateMac;
|
|
#endif
|
|
|
|
class ElectronBrowserMainParts : public content::BrowserMainParts {
|
|
public:
|
|
ElectronBrowserMainParts();
|
|
~ElectronBrowserMainParts() override;
|
|
|
|
// disable copy
|
|
ElectronBrowserMainParts(const ElectronBrowserMainParts&) = delete;
|
|
ElectronBrowserMainParts& operator=(const ElectronBrowserMainParts&) = delete;
|
|
|
|
static ElectronBrowserMainParts* Get();
|
|
|
|
// Sets the exit code, will fail if the message loop is not ready.
|
|
bool SetExitCode(int code);
|
|
|
|
// Gets the exit code
|
|
int GetExitCode() const;
|
|
|
|
// Returns the connection to GeolocationControl which can be
|
|
// used to enable the location services once per client.
|
|
device::mojom::GeolocationControl* GetGeolocationControl();
|
|
|
|
// Returns handle to the class responsible for extracting file icons.
|
|
IconManager* GetIconManager();
|
|
|
|
Browser* browser() { return browser_.get(); }
|
|
BrowserProcessImpl* browser_process() { return fake_browser_process_.get(); }
|
|
|
|
protected:
|
|
// content::BrowserMainParts:
|
|
int PreEarlyInitialization() override;
|
|
void PostEarlyInitialization() override;
|
|
int PreCreateThreads() override;
|
|
void ToolkitInitialized() override;
|
|
int PreMainMessageLoopRun() override;
|
|
void WillRunMainMessageLoop(
|
|
std::unique_ptr<base::RunLoop>& run_loop) override;
|
|
void PostCreateMainMessageLoop() override;
|
|
void PostMainMessageLoopRun() override;
|
|
void PreCreateMainMessageLoop() override;
|
|
void PostCreateThreads() override;
|
|
void PostDestroyThreads() override;
|
|
|
|
private:
|
|
void PreCreateMainMessageLoopCommon();
|
|
|
|
#if BUILDFLAG(IS_POSIX)
|
|
// Set signal handlers.
|
|
void HandleSIGCHLD();
|
|
void InstallShutdownSignalHandlers(
|
|
base::OnceCallback<void()> shutdown_callback,
|
|
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
|
|
#endif
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
void FreeAppDelegate();
|
|
void RegisterURLHandler();
|
|
void InitializeMainNib();
|
|
static std::string GetCurrentSystemLocale();
|
|
#endif
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
std::unique_ptr<ViewsDelegateMac> views_delegate_;
|
|
#else
|
|
std::unique_ptr<ViewsDelegate> views_delegate_;
|
|
#endif
|
|
|
|
#if defined(USE_AURA)
|
|
std::unique_ptr<wm::WMState> wm_state_;
|
|
std::unique_ptr<display::Screen> screen_;
|
|
#endif
|
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
|
|
std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
|
|
#endif
|
|
|
|
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
|
|
|
// A fake BrowserProcess object that used to feed the source code from chrome.
|
|
std::unique_ptr<BrowserProcessImpl> fake_browser_process_;
|
|
|
|
// A place to remember the exit code once the message loop is ready.
|
|
// Before then, we just exit() without any intermediate steps.
|
|
std::optional<int> exit_code_;
|
|
|
|
const std::unique_ptr<NodeBindings> node_bindings_;
|
|
|
|
// depends-on: node_bindings_
|
|
const std::unique_ptr<ElectronBindings> electron_bindings_;
|
|
|
|
// depends-on: node_bindings_
|
|
std::unique_ptr<JavascriptEnvironment> js_env_;
|
|
|
|
// depends-on: js_env_'s isolate
|
|
std::shared_ptr<node::Environment> node_env_;
|
|
|
|
// depends-on: js_env_'s isolate
|
|
std::unique_ptr<Browser> browser_;
|
|
|
|
std::unique_ptr<IconManager> icon_manager_;
|
|
std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
std::unique_ptr<ElectronExtensionsClient> extensions_client_;
|
|
std::unique_ptr<ElectronExtensionsBrowserClient> extensions_browser_client_;
|
|
#endif
|
|
|
|
mojo::Remote<device::mojom::GeolocationControl> geolocation_control_;
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
std::unique_ptr<display::ScopedNativeScreen> screen_;
|
|
#endif
|
|
|
|
static ElectronBrowserMainParts* self_;
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|