Where are the list of all Brave new tab wallpapers stored?

I have been digging through Brave’s source code and new tab’s network calls, but I, for the life of me, cannot seem to figure out where Brave stores a list of all its new tab wallpapers. I was able to track down the hook that makes the decision between displaying a color or wallpaper in brave_new_tab_page.bundle.js, but that’s not what I was looking for.

@tresabhi

Take a look at: ‘https://github.com/brave/brave-core/blob/master/browser/ntp_background_images/sources.gni


Might be outdated info:

Core file:

  • brave-core/components/brave_new_tab_ui/data/backgrounds.ts

This file defines:

  • the wallpaper catalog
  • metadata (author, link, campaign tags, etc.)
  • sometimes grouping / seasonal sets

Yup, I have seen this thread tens of times. This is not it.

@tresabhi

Did you look at the other link?

https://github.com/brave/brave-core/blob/master/browser/ntp_background_images/sources.gni

brave_browser_ntp_background_images_sources = [
“//brave/browser/ntp_background_images/view_counter_service_factory.cc”,
“//brave/browser/ntp_background_images/view_counter_service_factory.h”,

That’s not it, but it’s in the right-ish location. So far, components/brave_new_tab_ui/api/initialData.ts LOC 60 seems interesting.

Edit 1: components/brave_new_tab_ui/api/background.ts LOC 52

Edit 2: gen/brave/components/brave_new_tab_ui/brave_new_tab_page.mojom.m.js seems to be a dynamically generated script which exports a PageHandlerRemote class with has the getBraveBackgrounds method, which is what populates the list.

Edit 2: components/ntp_background_images/browser/mojom seems to be responsible for generating `brave_new_tab_page.mojom.m.js during build time.

@tresabhi

Where Brave Browser colors are:

https://github.com/brave/brave-core/blob/master/browser/ui/color/brave_color_mixer.cc


Generates background images:

https://github.com/brave/brave-core-crx-packager/blob/7420a87f35e40572eb94188a325f1e253e0a3c57/scripts/generateNTPBackgroundImages.js#L23


Looks like what you are looking for:

https://github.com/brave/chromium/blob/4745c5efede5e0dd03aaee83bb2925b69a6e67d2/ash/wallpaper/wallpaper_controller_impl.h#L72

https://github.com/brave/chromium/tree/4745c5efede5e0dd03aaee83bb2925b69a6e67d2/ash/wallpaper

The wallpaper_controller_impl.h file explains the workings. I copied the file and changed the filename suffix to .txt for uploading to this forum:

wallpaper_controller_impl.txt (39.8 KB)