8532e1239e
* chore: bump chromium in DEPS to 92.0.4512.6
* 2887336: [CaptureHandle][#2] Propagate CaptureHandleConfig in browser process
https://chromium-review.googlesource.com/c/chromium/src/+/2887336
* refactor: base::Optional -> absl::optional
* chore: fixup patch indices
* chore: bump chromium in DEPS to 92.0.4514.0
* 2899417: Make build work when enable_pdf is set to false.
https://chromium-review.googlesource.com/c/chromium/src/+/2899417
* 2904731: use BrowserContext instead of Profile in PreconnectManager
https://chromium-review.googlesource.com/c/chromium/src/+/2904731
* 2295749: fix: check IsSecureEventInputEnabled in constructor before setting SetPasswordInputEnabled to true
https://chromium-review.googlesource.com/c/chromium/src/+/2295749
* 2893803: Add a GetWebView to RenderFrame.
https://chromium-review.googlesource.com/c/chromium/src/+/2893803
* 2892345: Implement WebContents::ForEachRenderFrameHost
https://chromium-review.googlesource.com/c/chromium/src/+/2892345
* chore: fixup patch indices
* 2892048: Real instance methods for BrowserContext: remaining 5 methods.
https://chromium-review.googlesource.com/c/chromium/src/+/2892048
* 2902821: [mojo] Don't require full header includes for referenced interfaces
https://chromium-review.googlesource.com/c/chromium/src/+/2902821
* 2496500: Remove last deprecated extension Event ctor.
https://chromium-review.googlesource.com/c/chromium/src/+/2496500
* chore: fixup malformed pepper support patch
* chore: bump chromium in DEPS to 92.0.4515.0
* 2908461: Add CreateEmptyPrintPagesParamsPtr() inside print_view_manager_base.cc.
https://chromium-review.googlesource.com/c/chromium/src/+/2908461
* 2880838: viz: add optional HDRMetadata to TransferableResource
https://chromium-review.googlesource.com/c/chromium/src/+/2880838
* chore: fixup patch indices
* chore: bump chromium in DEPS to 92.0.4515.5
* chore: update patches
* chore: bump chromium in DEPS to 92.0.4515.7
* chore: bump chromium in DEPS to 92.0.4515.9
* chore: bump chromium in DEPS to 93.0.4522.0
* chore: bump chromium in DEPS to 93.0.4523.0
* chore: bump chromium in DEPS to 93.0.4524.0
* chore: update patches
* chore: enable_pak_file_integrity_checks was reverted
* chore: update patches
* refactor: base/optional was replaced with absl::optional
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202
* refactor: replace all usages of base::nullopt with absl::nullopt
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202
* chore: add missing base::Contains include
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202
* refactor: replace all usages of base::make_optional with
absl::make_optional
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202
* refactor: replace WorldScriptContext() with GetScriptContextFromWorldId
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893213
* chore: clean up left over opening namespace
Refs: 95bfe6d08f
* chore: add missing base::Contains include
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2910202
* refactor: replace GetCurrentDisplayIterator with the hard checker
GetCurrentDisplay
This code looks suspicious but if the iterator was invalid before it
will also be invalid now.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2893191
* refactor: headers are now passed directly in extensions client
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2918906
* refactor: base::DictionaryValue::empty() has been removed
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2912424
* chore: add missing includes for network URLLoaderFactory
Refs: unknown, probably a side effect of header changes
* refactor: make convenience wrapper around AppendArg
There is no converter FromV8 for base::StringPiece (apparently its not
possible). So we now take in an std::string and use the construct for
StringPiece to do implicit conversion.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2905544
* chore: add patch
* chore: bump chromium in DEPS to 93.0.4525.0
* chore: update patches
* refactor: CanResize has been de-virtualized
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2485774
* chore: update resource integrity patch
* chore: add character encoding idl patch
* chore: bump chromium in DEPS to 93.0.4526.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4527.0
* chore: bump chromium in DEPS to 93.0.4528.0
* chore: update patches
* chore: update idl encoding patch
* chore: bump chromium in DEPS to 93.0.4529.0
* chore: update patches
* chore: bump chromium in DEPS to 93.0.4530.0
* chore: update patches
* fix: only SetCanResize after the widget has been initialized
* chore: add patch for vr on windows gn gen
* spec: fix focus related tests on linux due to delay in focus swap
* chore: remove new usages of base::Optional from main
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
170 lines
4.7 KiB
C++
170 lines
4.7 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 SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
|
#define SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "base/callback.h"
|
|
#include "base/metrics/field_trial.h"
|
|
#include "base/timer/timer.h"
|
|
#include "content/public/browser/browser_context.h"
|
|
#include "content/public/browser/browser_main_parts.h"
|
|
#include "content/public/common/main_function_params.h"
|
|
#include "electron/buildflags/buildflags.h"
|
|
#include "mojo/public/cpp/bindings/remote.h"
|
|
#include "services/device/public/mojom/geolocation_control.mojom.h"
|
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
#include "ui/views/layout/layout_provider.h"
|
|
|
|
class BrowserProcess;
|
|
class IconManager;
|
|
|
|
#if defined(USE_AURA)
|
|
namespace wm {
|
|
class WMState;
|
|
}
|
|
|
|
namespace display {
|
|
class Screen;
|
|
}
|
|
#endif
|
|
|
|
#if defined(USE_X11)
|
|
namespace ui {
|
|
class GtkUiPlatform;
|
|
}
|
|
#endif
|
|
|
|
namespace electron {
|
|
|
|
class ElectronBrowserContext;
|
|
class Browser;
|
|
class ElectronBindings;
|
|
class JavascriptEnvironment;
|
|
class NodeBindings;
|
|
class NodeEnvironment;
|
|
class BridgeTaskRunner;
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
class ElectronExtensionsClient;
|
|
class ElectronExtensionsBrowserClient;
|
|
#endif
|
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
class ViewsDelegate;
|
|
#endif
|
|
|
|
#if defined(OS_MAC)
|
|
class ViewsDelegateMac;
|
|
#endif
|
|
|
|
#if defined(OS_LINUX)
|
|
class DarkThemeObserver;
|
|
#endif
|
|
|
|
class ElectronBrowserMainParts : public content::BrowserMainParts {
|
|
public:
|
|
explicit ElectronBrowserMainParts(const content::MainFunctionParams& params);
|
|
~ElectronBrowserMainParts() override;
|
|
|
|
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 defined(OS_POSIX)
|
|
// Set signal handlers.
|
|
void HandleSIGCHLD();
|
|
void InstallShutdownSignalHandlers(
|
|
base::OnceCallback<void()> shutdown_callback,
|
|
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
|
|
#endif
|
|
|
|
#if defined(OS_MAC)
|
|
void FreeAppDelegate();
|
|
void RegisterURLHandler();
|
|
void InitializeMainNib();
|
|
#endif
|
|
|
|
#if defined(OS_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 defined(OS_LINUX)
|
|
// Used to notify the native theme of changes to dark mode.
|
|
std::unique_ptr<DarkThemeObserver> dark_theme_observer_;
|
|
#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.
|
|
absl::optional<int> exit_code_;
|
|
|
|
std::unique_ptr<JavascriptEnvironment> js_env_;
|
|
std::unique_ptr<Browser> browser_;
|
|
std::unique_ptr<NodeBindings> node_bindings_;
|
|
std::unique_ptr<ElectronBindings> electron_bindings_;
|
|
std::unique_ptr<NodeEnvironment> node_env_;
|
|
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_;
|
|
|
|
static ElectronBrowserMainParts* self_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserMainParts);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|