Files
brave-core/browser/brave_ads
Serg 0c513a33ea Decouple PolicyService::Observer from AdsServiceImpl (#36437)
* Decouple PolicyService::Observer from AdsServiceImpl

Move the "defer ads service start until policy is initialized" pattern out
of `AdsServiceImpl` into a reusable `brave_policy::PolicyInitializationWaiter`
helper. `AdsServiceImpl` no longer inherits from `policy::PolicyService::Observer`
or takes a `policy::PolicyService*` in its constructor; `AdsServiceFactory`
builds the waiter from the profile policy connector and injects it.

Also drops the temporary `[AdsGate]` verbose logging that was added with the
original race fix; behaviour is now covered by unit tests.

The new helper lives at `brave/components/brave_policy/policy_initialization_waiter.{h,cc}`
and is reusable by any service that needs to defer initialization until
`PolicyService` has merged its policy bundle into the managed pref store.

Resolves: https://github.com/brave/brave-browser/issues/55266
2026-05-15 17:41:37 -04:00
..