blob: 6a40d4c6c03b092e4daca52345e2259e6157d1ff [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
[email protected]147f8092012-03-21 11:47:452// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]de7d61ff2013-08-20 11:30:415#ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6#define CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
[email protected]147f8092012-03-21 11:47:457
dcheng6003e0b2016-04-09 18:42:348#include <memory>
9
chaopeng90e2c6042017-11-22 22:47:4310#include "base/metrics/field_trial.h"
avi66a07722015-12-25 23:38:1211#include "build/build_config.h"
[email protected]147f8092012-03-21 11:47:4512#include "content/public/browser/browser_main_parts.h"
mkwst36b11b6f2014-10-15 16:18:5613#include "content/shell/browser/shell_browser_context.h"
Xianzhu Wang6be66b012020-05-06 17:17:2514
Julie Jeongeun Kimbb75cae2023-05-20 13:37:5115#if BUILDFLAG(IS_IOS)
Alvin Ji0ff27272024-03-13 21:57:2716#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
Julie Jeongeun Kimbb75cae2023-05-20 13:37:5117#endif
18
Ulan Degenbaev70cc52752020-09-30 15:25:0519namespace performance_manager {
20class PerformanceManagerLifetime;
21} // namespace performance_manager
22
Will Harris09785ba2022-04-14 00:07:3723#if BUILDFLAG(IS_ANDROID)
24namespace crash_reporter {
25class ChildExitObserver;
26}
27#endif
28
[email protected]147f8092012-03-21 11:47:4529namespace content {
danakjde3e2a02020-05-12 16:51:2030class ShellPlatformDelegate;
[email protected]147f8092012-03-21 11:47:4531
Sergey Ulanovd283ff92023-03-03 20:59:4732#if BUILDFLAG(IS_FUCHSIA)
33class FuchsiaViewPresenter;
34#endif
35
[email protected]147f8092012-03-21 11:47:4536class ShellBrowserMainParts : public BrowserMainParts {
37 public:
Gabriel Charette4c1897a2022-05-02 18:22:2538 ShellBrowserMainParts();
Peter Boström828b9022021-09-21 02:28:4339
40 ShellBrowserMainParts(const ShellBrowserMainParts&) = delete;
41 ShellBrowserMainParts& operator=(const ShellBrowserMainParts&) = delete;
42
dchenge933b3e2014-10-21 11:44:0943 ~ShellBrowserMainParts() override;
[email protected]147f8092012-03-21 11:47:4544
[email protected]78089f02012-07-19 06:11:2845 // BrowserMainParts overrides.
Scott Violet9068b4df2018-01-12 16:44:2146 int PreEarlyInitialization() override;
jbudoricke834612b2016-04-02 22:36:4147 int PreCreateThreads() override;
Xiaohan Wangbd084422022-01-15 18:47:5148#if BUILDFLAG(IS_MAC)
Gabriel Charette09c6a96e2021-05-17 14:52:5949 void PreCreateMainMessageLoop() override;
Maksim Sisov2ac2c312021-11-03 08:00:1250#endif
51 void PostCreateThreads() override;
Gabriel Charette09c6a96e2021-05-17 14:52:5952 void PostCreateMainMessageLoop() override;
Xianzhu Wang6be66b012020-05-06 17:17:2553 void ToolkitInitialized() override;
Gabriel Charettec716bcf32021-03-16 16:25:3554 int PreMainMessageLoopRun() override;
55 void WillRunMainMessageLoop(
56 std::unique_ptr<base::RunLoop>& run_loop) override;
dchenge933b3e2014-10-21 11:44:0957 void PostMainMessageLoopRun() override;
ortunod7279d062016-01-16 02:08:3158 void PostDestroyThreads() override;
Julie Jeongeun Kimbb75cae2023-05-20 13:37:5159#if BUILDFLAG(IS_IOS)
Alvin Ji0ff27272024-03-13 21:57:2760 device::GeolocationSystemPermissionManager*
61 GetGeolocationSystemPermissionManager();
Julie Jeongeun Kimbb75cae2023-05-20 13:37:5162#endif
[email protected]147f8092012-03-21 11:47:4563
[email protected]3560b572012-04-04 20:47:3264 ShellBrowserContext* browser_context() { return browser_context_.get(); }
[email protected]71d504f2012-07-25 17:15:2865 ShellBrowserContext* off_the_record_browser_context() {
66 return off_the_record_browser_context_.get();
67 }
[email protected]3560b572012-04-04 20:47:3268
mkwst36b11b6f2014-10-15 16:18:5669 protected:
70 virtual void InitializeBrowserContexts();
71 virtual void InitializeMessageLoopContext();
danakjde3e2a02020-05-12 16:51:2072 // Gets the ShellPlatformDelegate to be used. May be a subclass of
73 // ShellPlatformDelegate to change behaviour based on platform or for tests.
74 virtual std::unique_ptr<ShellPlatformDelegate> CreateShellPlatformDelegate();
mkwst36b11b6f2014-10-15 16:18:5675
76 void set_browser_context(ShellBrowserContext* context) {
77 browser_context_.reset(context);
78 }
79 void set_off_the_record_browser_context(ShellBrowserContext* context) {
80 off_the_record_browser_context_.reset(context);
81 }
82
[email protected]147f8092012-03-21 11:47:4583 private:
dcheng6003e0b2016-04-09 18:42:3484 std::unique_ptr<ShellBrowserContext> browser_context_;
85 std::unique_ptr<ShellBrowserContext> off_the_record_browser_context_;
[email protected]3560b572012-04-04 20:47:3286
Ulan Degenbaev70cc52752020-09-30 15:25:0587 std::unique_ptr<performance_manager::PerformanceManagerLifetime>
88 performance_manager_lifetime_;
Will Harris09785ba2022-04-14 00:07:3789#if BUILDFLAG(IS_ANDROID)
90 std::unique_ptr<crash_reporter::ChildExitObserver> child_exit_observer_;
91#endif
Sergey Ulanovd283ff92023-03-03 20:59:4792#if BUILDFLAG(IS_FUCHSIA)
93 std::unique_ptr<FuchsiaViewPresenter> fuchsia_view_presenter_;
94#endif
[email protected]147f8092012-03-21 11:47:4595};
96
97} // namespace content
98
[email protected]de7d61ff2013-08-20 11:30:4199#endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_