Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up a Shell class entry for Cobalt #4612

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kaidokert
Copy link
Member

@kaidokert kaidokert commented Dec 19, 2024

Sets up a Cobalt specific Shell class and necessary wiring to provide an instance of it at startup. It's currently delegating most of the functionality to content::Shell.

content::Shell itself is currently hacked, as it's not designed or intended for sub-classing. This should be cleaned up in the future and Cobalt should fully own all of the related code to set up the shell.

The main immediate use is to be able to override WebContentsObserver events, like PrimaryMainDocumentElementAvailable.

b/384979128
b/390021478

@kaidokert kaidokert requested a review from johnxwork December 19, 2024 02:34
@kaidokert kaidokert force-pushed the scaffold_shell branch 2 times, most recently from 57861d7 to 80ba1a4 Compare December 19, 2024 02:37
@kaidokert kaidokert force-pushed the scaffold_shell branch 2 times, most recently from a8184a2 to 09ee019 Compare January 14, 2025 06:37
@kaidokert kaidokert changed the title Draft: Scaffold shell entry for Cobalt Set up a Shell class entry for Cobalt Jan 14, 2025
@kaidokert kaidokert marked this pull request as ready for review January 14, 2025 06:44
@kaidokert kaidokert requested review from a team as code owners January 14, 2025 06:44
@kaidokert kaidokert requested a review from aee-google January 14, 2025 06:46
@@ -108,6 +108,14 @@ Shell* Shell::CreateShell(std::unique_ptr<WebContents> web_contents,
bool should_set_delegate) {
WebContents* raw_web_contents = web_contents.get();
Shell* shell = new Shell(std::move(web_contents), should_set_delegate);
#if BUILDFLAG(IS_COBALT)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewsavage1 i'd expect you to comment on this - it's really ugly, but the patch/diff illustrates intent clearly.

I can make this little less ugly by doing a bit more elaborate #if oldcode #else hackedcode block maybe.

I'd also hope this doesn't have to be very long lived.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further in the future, what do we want to happen with references to content::shell::Shell already in Chromium code? Do we want them to reference cobalt::Shell or are we okay with them not changing?

I'm not sure why we want to continue to use this class at all instead of fully copying it over into cobalt_shell—isn't that the end goal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The end goal is not to rely on content::shell:Shell at all. I put this in as a reasonably self-contained incremental step to allow us to extend, without having to keep modifying the code in content/shell directly.

I'm honestly not sure how many direct references there would remain to content::shell::Shell - it's sort of a "leaf" in the dependency chain. In our own copy of the code we would just have CobaltShell or such.

cobalt/android/shell_manager.h Outdated Show resolved Hide resolved
cobalt/android/shell_manager.h Show resolved Hide resolved
@@ -0,0 +1,33 @@
// Copyright 2013 The Chromium Authors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file needed? which part is changes after it is copied from content/shell/browser?

Copy link
Member Author

@kaidokert kaidokert Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it is not currently needed. I only copied it over because all of those 4 are grouped together in gn in a single block.

I'm expecting we may need to override our own Delegate soon however, too.

cobalt/android/shell_manager.cc Show resolved Hide resolved
cobalt/cobalt_shell.cc Show resolved Hide resolved
@kaidokert kaidokert requested a review from sideb0ard January 14, 2025 19:28
Copy link
Contributor

@andrewsavage1 andrewsavage1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a stepping stone

content/shell/browser/shell.h Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants