CueTargetType type = static_cast<CueTargetType>(i);
TargetStats stats;
stats.impressions =
pref_service_->GetInteger(prefs::GetImpressionsPrefName(type));
stats.clicks = pref_service_->GetInteger(prefs::GetClicksPrefName(type));
stats.dismissals =
pref_service_->GetInteger(prefs::GetDismissalsPrefName(type));Nit, I'd slightly like to see this move to a helper in prefs.cc, something like GetTargetStatsFromPrefs(pref_service_, type)
pref_service_->SetInteger(prefs::GetImpressionsPrefName(type),
stats.impressions);
pref_service_->SetInteger(prefs::GetClicksPrefName(type), stats.clicks);
pref_service_->SetInteger(prefs::GetDismissalsPrefName(type),
stats.dismissals);Same nit as above, can you please put this in a helper in prefs.cc?
return std::string("contextual_cueing.ucb.") +
base::ToLowerASCII(GetName(type)) + ".";Nit, consider base::StrCat here
registry->RegisterIntegerPref(GetImpressionsPrefName(type), 0);
registry->RegisterIntegerPref(GetClicksPrefName(type), 0);
registry->RegisterIntegerPref(GetDismissalsPrefName(type), 0);optional: instead of individually registering each of these pref paths for each CueTargetType, you could store all of it in a base::DictValue like this:
```
pref contextual_cueing.ucb = base::DictValue {
glic = base::DictValue {
impressions = 0,
clicks = 0,
dismissals = 0,
},
...
}
```
Up to you since while it does make registration simpler, it would make reading and writing more complicated.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
CueTargetType type = static_cast<CueTargetType>(i);
TargetStats stats;
stats.impressions =
pref_service_->GetInteger(prefs::GetImpressionsPrefName(type));
stats.clicks = pref_service_->GetInteger(prefs::GetClicksPrefName(type));
stats.dismissals =
pref_service_->GetInteger(prefs::GetDismissalsPrefName(type));Nit, I'd slightly like to see this move to a helper in prefs.cc, something like GetTargetStatsFromPrefs(pref_service_, type)
Done
pref_service_->SetInteger(prefs::GetImpressionsPrefName(type),
stats.impressions);
pref_service_->SetInteger(prefs::GetClicksPrefName(type), stats.clicks);
pref_service_->SetInteger(prefs::GetDismissalsPrefName(type),
stats.dismissals);Same nit as above, can you please put this in a helper in prefs.cc?
Done
return std::string("contextual_cueing.ucb.") +
base::ToLowerASCII(GetName(type)) + ".";Nit, consider base::StrCat here
Done
registry->RegisterIntegerPref(GetImpressionsPrefName(type), 0);
registry->RegisterIntegerPref(GetClicksPrefName(type), 0);
registry->RegisterIntegerPref(GetDismissalsPrefName(type), 0);optional: instead of individually registering each of these pref paths for each CueTargetType, you could store all of it in a base::DictValue like this:
```
pref contextual_cueing.ucb = base::DictValue {
glic = base::DictValue {
impressions = 0,
clicks = 0,
dismissals = 0,
},
...
}
```Up to you since while it does make registration simpler, it would make reading and writing more complicated.
Omitted; Flat preferences are probably easier to update and increment individually
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
SEQUENCE_CHECKER(sequence_checker_);i think we generally want sequence checker to be the last thing to get destructed
static const TargetStats kEmptyStats;i think you just need the ucb scorer for this - can you forward declare
or maybe make as an internal var
void ContextualCueingServiceFactory::RegisterProfilePrefs(why here?
should just register in browser_prefs.cc
namespace prefs {would just have RegisterProfilePrefs be here instead of the factory - consistent with other classes
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
i think this can be in impl
Done
i think we generally want sequence checker to be the last thing to get destructed
Done
i think you just need the ucb scorer for this - can you forward declare
or maybe make as an internal var
Done; made internal
void ContextualCueingServiceFactory::RegisterProfilePrefs(why here?
should just register in browser_prefs.cc
Done, i think
would just have RegisterProfilePrefs be here instead of the factory - consistent with other classes
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
const raw_ptr<PrefService> pref_service_;can you specify that these are the profile prefs specifically - there are also prefs on the install level (local state) - and we should just be more specific here to avoid making mistakes
#include "components/prefs/pref_service.h"fwd declare prefservice
if (!pref_service_) {when is pref service null? i think its always available?
std::make_unique<ContextualCueingService>(/*pref_service=*/nullptr);why not just test the prefs get persisted?
class ContextualCueingServicePrefTest : public testing::Test {why not just have this be the default behavior?
i dont think it makes sense to really have anything be truly ephemeral for session?
#include "chrome/browser/contextual_cueing/ucb_scorer.h"is this import still needed?
contextual_cueing::prefs::RegisterProfilePrefs(registry);alphabetize - this should be right above 1685
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
can you specify that these are the profile prefs specifically - there are also prefs on the install level (local state) - and we should just be more specific here to avoid making mistakes
Done
#include "components/prefs/pref_service.h"Benedict Wongfwd declare prefservice
Done. Do i forward declare instead of import for basically any non-coupled service?
when is pref service null? i think its always available?
Done. default defensive.
std::make_unique<ContextualCueingService>(/*pref_service=*/nullptr);why not just test the prefs get persisted?
Done
class ContextualCueingServicePrefTest : public testing::Test {why not just have this be the default behavior?
i dont think it makes sense to really have anything be truly ephemeral for session?
Done
#include "chrome/browser/contextual_cueing/ucb_scorer.h"is this import still needed?
Done
contextual_cueing::prefs::RegisterProfilePrefs(registry);alphabetize - this should be right above 1685
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Extend ContextualCueingService with per-target UCB stats tracking
Add per-target TargetStats tracking to ContextualCueingService to
support UCB scorer ranking in the upcoming V2 multi-source orchestration
path.
Changes:
- OnCueShown now takes a CueTargetType parameter to associate each
impression with the target that triggered it.
- OnCueClicked and OnCueDismissed now update per-target click/dismissal
counters in addition to the existing global backoff state.
- Persist per-target stats (impressions, clicks, dismissals) across browser
restarts using Profile Prefs (prefs.h/cc), ensuring UCB scoring carries
historical signal across sessions.
- Add dismiss_count_ = 0; to OnCueClicked to correctly reset the global
dismissal backoff multiplier when a cue is clicked, fulfilling the existing
header documentation requirement (which was missing in the V1 implementation).
- GetStatsForTarget(type): returns the TargetStats for a given target,
used by the UCB scorer to compute exploit/explore scores.
- GetTotalImpressions(): sums impressions across all targets, used as
the global n_total for the UCB exploration bonus.
- Move ucb_scorer.h to the public :contextual_cueing target so it can
be included from the public service header without gn check failures.
TAG=agy
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |