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

Use component for NTP Background images on desktop #10690

Merged
merged 7 commits into from
Oct 30, 2021

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Oct 26, 2021

Resolves brave/brave-browser#10278

Use component for ntp background images on desktop.

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • 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, npm run lint, 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:

  1. Launch brave and check first NTP is below spensor's photo
  2. Check NTP Background Images is loaded in brave://components
  3. If not loaded, every NTP will display below bundled image.
  4. If already loaded, NTP will show different images from components
  5. Toggle Show Sponsored Images or Show Background Images option and check BG images are shown properly based on changed option

Screen Shot 2021-10-28 at 6 17 19 PM

@simonhong simonhong self-assigned this Oct 26, 2021
@simonhong simonhong changed the title WIP: Use component for NTP Background images WIP: Use component for NTP Background images on desktop Oct 26, 2021
@simonhong simonhong force-pushed the ntp_background_crx_desktop branch 5 times, most recently from d784ec3 to c23760a Compare October 28, 2021 03:17
RegisterPageView() wiil be no-op if NTP SI/BI is not ready to use.
Existing NTPBackgroundImagesSource is renamed to
NTPSponsoredImagesSource and NTPBackgroundImagesSource is newly
implemented for serving NTP BI images.

With this change, WebUI will get every bg images via
chrome://background-wallpaper/wallpaper-x.webp url.

When NTP BI component is ready, bg image is loaded in the tab by
NTP BI url such as brave://background-wallpaper/wallpaper-10.webp.
@simonhong simonhong marked this pull request as ready for review October 28, 2021 03:25
@simonhong simonhong force-pushed the ntp_background_crx_desktop branch 2 times, most recently from f9bba8f to 8ce4908 Compare October 28, 2021 04:00
@simonhong simonhong force-pushed the ntp_background_crx_desktop branch 2 times, most recently from e11dc7d to a89ae80 Compare October 28, 2021 05:39
NewTab's state will have below two struct.
* NewTab.BackgroundWallpaper
* NewTab.BrandedWallpaper

NTP will display spencer-moore_lake.avif till NTP BI component
is ready like android does.
For reducing complexity, ViewCounterModel is resseted whenever
Component is updated or related prefs are changed.
But ViewCounterModel::count_to_branded_wallpaper_ is not changed
to show first branded wallpaper at 2nd NTP loading.
@simonhong simonhong changed the title WIP: Use component for NTP Background images on desktop Use component for NTP Background images on desktop Oct 28, 2021
Copy link
Member

@fmarier fmarier left a comment

Choose a reason for hiding this comment

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

script/generate_licenses.py changes look good to me.

Copy link
Contributor

@wchen342 wchen342 left a comment

Choose a reason for hiding this comment

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

++

@simonhong
Copy link
Member Author

Merged because pylint failure is not related with this PR's change.

@simonhong simonhong merged commit f493069 into master Oct 30, 2021
@simonhong simonhong deleted the ntp_background_crx_desktop branch October 30, 2021 15:58
@simonhong simonhong added this to the 1.33.x - Nightly milestone Oct 30, 2021
simonhong added a commit that referenced this pull request Oct 31, 2021
f/u PR for github.com//pull/10690

CI missed this because generated buildflag header isn't deleted
if wipeout workspace.
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.

Desktop - Download background images via CRX
3 participants