diff options
Diffstat (limited to 'chromium/weblayer/shell/app')
-rw-r--r-- | chromium/weblayer/shell/app/shell_main_params.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/chromium/weblayer/shell/app/shell_main_params.cc b/chromium/weblayer/shell/app/shell_main_params.cc index 36e58d734ae..9ece1e23cda 100644 --- a/chromium/weblayer/shell/app/shell_main_params.cc +++ b/chromium/weblayer/shell/app/shell_main_params.cc @@ -49,29 +49,45 @@ GURL GetStartupURL() { class MainDelegateImpl : public MainDelegate { public: void PreMainMessageLoopRun() override { + // On Android the Profile is created and owned in Java via an + // embedder-specific call to WebLayer.createBrowserFragment(). +#if !defined(OS_ANDROID) InitializeProfile(); +#endif Shell::Initialize(); +#if defined(OS_ANDROID) + Shell::CreateNewWindow(GetStartupURL(), gfx::Size()); +#else Shell::CreateNewWindow(profile_.get(), GetStartupURL(), gfx::Size()); +#endif } - void PostMainMessageLoopRun() override { DestroyProfile(); } + void PostMainMessageLoopRun() override { +#if !defined(OS_ANDROID) + DestroyProfile(); +#endif + } void SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure) override { Shell::SetMainMessageLoopQuitClosure(std::move(quit_closure)); } private: +#if !defined(OS_ANDROID) void InitializeProfile() { - profile_ = Profile::Create("web_shell"); + auto* command_line = base::CommandLine::ForCurrentProcess(); + std::string profile_name = + command_line->HasSwitch(switches::kStartInIncognito) ? "" : "web_shell"; - // TODO: create an incognito profile as well. + profile_ = Profile::Create(profile_name); } void DestroyProfile() { profile_.reset(); } std::unique_ptr<Profile> profile_; +#endif }; } // namespace |