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

[Tabs]: Add BraveTabFeatures #27322

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

fallaciousreasoning
Copy link
Contributor

Resolves brave/brave-browser#43437

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

N/A - no changes to existing behavior

@fallaciousreasoning fallaciousreasoning requested review from a team and bridiver as code owners January 22, 2025 22:23
@github-actions github-actions bot added CI/run-network-audit Run network-audit CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux) labels Jan 22, 2025
@fallaciousreasoning fallaciousreasoning requested a review from a team as a code owner January 23, 2025 00:26
Comment on lines 376 to 377
"//brave/browser/android/brave_tab_features_android.cc",
"//brave/browser/android/brave_tab_features_android.h",
Copy link
Contributor Author

@fallaciousreasoning fallaciousreasoning Jan 23, 2025

Choose a reason for hiding this comment

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

note: this is what upstream does. I imagine they'll change it at some point in the future but I think its good to match them for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's probably because there is a circular dependency in theirs? If we can avoid adding new sources to sources.gni directly, we should

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can put these in their own target, but I'll need to add a dep on //chrome/browser/android and allow_circular_includes_from - is that okay?

public:
TabFeaturesAndroid(content::WebContents* web_contents, Profile* profile);
- ~TabFeaturesAndroid();
+ virtual ~TabFeaturesAndroid();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should rename the base class so we don't need this patch. So change TabFeaturesAndroid -> TabFeaturesAndroid_ChromiumImpl and call our subclass TabFeaturesAndroid so there are no base class pointers? If we do that here we should do the same for TabFeatures for consistency

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually we can still name ours BraveTabFeatures* and typedef/using to also be TabFeatures*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think its better to subclass here - that way if upstream adds some new public methods (highly likely, judging by the look of TabFeatures on desktop) it won't break our overrides.

Additionally if we do that we'll need a std::unique_ptr<TabFeaturesAndroid_ChromiumImpl> on our class to ensure everything its instantiating still exists?

@fallaciousreasoning fallaciousreasoning force-pushed the brave-tab-featuresx branch 2 times, most recently from 8cde2ed to e8d84d5 Compare January 23, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-network-audit Run network-audit CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tabs]: We should subclass TabFeatures with a new BraveTabFeatures class to make it easier to add new features
2 participants