@@ -239,8 +239,22 @@ gfx::Size Shell::AdjustWindowSize(const gfx::Size& initial_size) {
239239Shell* Shell::CreateNewWindow (BrowserContext* browser_context,
240240 const GURL& url,
241241 const scoped_refptr<SiteInstance>& site_instance,
242- const gfx::Size& initial_size) {
242+ const gfx::Size& initial_size,
243+ const std::string& main_frame_name) {
243244 WebContents::CreateParams create_params (browser_context, site_instance);
245+ #if BUILDFLAG(IS_ANDROID)
246+ // Workaround to determine if WebContents is for main app or splash screen.
247+ // As a result, CobaltContentBrowserClient::OnWebContentsCreated() only
248+ // observes WebContents on main app.
249+ if (!main_frame_name.empty ()) {
250+ // Set |main_frame_name| for splash screen, where
251+ // ShellBrowserMainParts::InitializeMessageLoopContext() creates
252+ // WebContents, and it loads splash screen. On the other hand,
253+ // JNI_ShellManager_LaunchShell() should not set |main_frame_name|.
254+ create_params.main_frame_name = main_frame_name;
255+ }
256+ #endif // BUILDFLAG(IS_ANDROID)
257+
244258 if (base::CommandLine::ForCurrentProcess ()->HasSwitch (
245259 switches::kForcePresentationReceiverForTesting )) {
246260 create_params.starting_sandbox_flags = kPresentationReceiverSandboxFlags ;
0 commit comments