| Index: chrome/browser/web_resource/promo_resource_service.cc
|
| diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc
|
| index 16e92fe8434f9fcf2f6ce2c47674d9150d7ca96c..bc9f75bbda245d615f0e849841ff60613f39ba54 100644
|
| --- a/chrome/browser/web_resource/promo_resource_service.cc
|
| +++ b/chrome/browser/web_resource/promo_resource_service.cc
|
| @@ -37,9 +37,9 @@ static const int kTestCacheUpdateDelay = 3 * 60 * 1000;
|
| // to versions with different types of promos).
|
| static const int kPromoServiceVersion = 2;
|
|
|
| -// The number of groups sync promo users will be divided into (which gives us a
|
| -// 1/N granularity when targeting more groups).
|
| -static const int kSyncPromoNumberOfGroups = 100;
|
| +// The number of groups sign-in promo users will be divided into (which gives us
|
| +// a 1/N granularity when targeting more groups).
|
| +static const int kNTPSignInPromoNumberOfGroups = 100;
|
|
|
| // Properties used by the server.
|
| static const char kAnswerIdProperty[] = "answer_id";
|
| @@ -84,10 +84,10 @@ void PromoResourceService::RegisterUserPrefs(PrefService* prefs) {
|
| prefs->RegisterDoublePref(prefs::kNTPCustomLogoEnd,
|
| 0,
|
| PrefService::UNSYNCABLE_PREF);
|
| - prefs->RegisterIntegerPref(prefs::kNTPSyncPromoGroup,
|
| + prefs->RegisterIntegerPref(prefs::kNTPSignInPromoGroup,
|
| 0,
|
| PrefService::UNSYNCABLE_PREF);
|
| - prefs->RegisterIntegerPref(prefs::kNTPSyncPromoGroupMax,
|
| + prefs->RegisterIntegerPref(prefs::kNTPSignInPromoGroupMax,
|
| 0,
|
| PrefService::UNSYNCABLE_PREF);
|
| NotificationPromo::RegisterUserPrefs(prefs);
|
| @@ -154,7 +154,7 @@ void PromoResourceService::Unpack(const DictionaryValue& parsed_json) {
|
| UnpackLogoSignal(parsed_json);
|
| UnpackNotificationSignal(parsed_json);
|
| UnpackWebStoreSignal(parsed_json);
|
| - UnpackSyncPromoSignal(parsed_json);
|
| + UnpackNTPSignInPromoSignal(parsed_json);
|
| }
|
|
|
| void PromoResourceService::OnNewNotification(double start, double end) {
|
| @@ -376,7 +376,7 @@ void PromoResourceService::UnpackLogoSignal(
|
| }
|
| }
|
|
|
| -void PromoResourceService::UnpackSyncPromoSignal(
|
| +void PromoResourceService::UnpackNTPSignInPromoSignal(
|
| const DictionaryValue& parsed_json) {
|
| #if defined(OS_CHROMEOS)
|
| // Don't bother with this signal on ChromeOS. Users are already synced.
|
| @@ -398,7 +398,7 @@ void PromoResourceService::UnpackSyncPromoSignal(
|
| continue;
|
| DictionaryValue* a_dic = static_cast<DictionaryValue*>(*answer_iter);
|
| std::string name;
|
| - if (a_dic->GetString("name", &name) && name == "sync_promo") {
|
| + if (a_dic->GetString("name", &name) && name == "sign_in_promo") {
|
| a_dic->GetString("question", &question);
|
| break;
|
| }
|
| @@ -413,12 +413,12 @@ void PromoResourceService::UnpackSyncPromoSignal(
|
| !base::StringToInt(question.substr(build_index + 1), &new_group_max)) {
|
| // If anything about the response was invalid or this build is no longer
|
| // targeted and there are existing prefs, clear them and notify.
|
| - if (prefs_->HasPrefPath(prefs::kNTPSyncPromoGroup) ||
|
| - prefs_->HasPrefPath(prefs::kNTPSyncPromoGroupMax)) {
|
| + if (prefs_->HasPrefPath(prefs::kNTPSignInPromoGroup) ||
|
| + prefs_->HasPrefPath(prefs::kNTPSignInPromoGroupMax)) {
|
| // Make sure we clear first, as the following notification may possibly
|
| - // depend on calling CanShowSyncPromo synchronously.
|
| - prefs_->ClearPref(prefs::kNTPSyncPromoGroup);
|
| - prefs_->ClearPref(prefs::kNTPSyncPromoGroupMax);
|
| + // depend on calling CanShowNTPSignInPromo synchronously.
|
| + prefs_->ClearPref(prefs::kNTPSignInPromoGroup);
|
| + prefs_->ClearPref(prefs::kNTPSignInPromoGroupMax);
|
| // Notify the NTP resource cache if the promo has been disabled.
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
|
| @@ -432,26 +432,26 @@ void PromoResourceService::UnpackSyncPromoSignal(
|
|
|
| // If we successfully parsed a response and it differs from our user prefs,
|
| // set pref for next time to compare.
|
| - if (new_group_max != prefs_->GetInteger(prefs::kNTPSyncPromoGroupMax))
|
| - prefs_->SetInteger(prefs::kNTPSyncPromoGroupMax, new_group_max);
|
| + if (new_group_max != prefs_->GetInteger(prefs::kNTPSignInPromoGroupMax))
|
| + prefs_->SetInteger(prefs::kNTPSignInPromoGroupMax, new_group_max);
|
| }
|
|
|
| // static
|
| -bool PromoResourceService::CanShowSyncPromo(Profile* profile) {
|
| +bool PromoResourceService::CanShowNTPSignInPromo(Profile* profile) {
|
| DCHECK(profile);
|
| PrefService* prefs = profile->GetPrefs();
|
|
|
| - if (!prefs->HasPrefPath(prefs::kNTPSyncPromoGroupMax))
|
| + if (!prefs->HasPrefPath(prefs::kNTPSignInPromoGroupMax))
|
| return false;
|
|
|
| // If there's a max group set and the user hasn't been bucketed yet, do it.
|
| - if (!prefs->HasPrefPath(prefs::kNTPSyncPromoGroup)) {
|
| - prefs->SetInteger(prefs::kNTPSyncPromoGroup,
|
| - base::RandInt(1, kSyncPromoNumberOfGroups));
|
| + if (!prefs->HasPrefPath(prefs::kNTPSignInPromoGroup)) {
|
| + prefs->SetInteger(prefs::kNTPSignInPromoGroup,
|
| + base::RandInt(1, kNTPSignInPromoNumberOfGroups));
|
| }
|
|
|
| // A response is not kept if the build wasn't targeted, so the only thing
|
| // required to check is the group this client has been tagged in.
|
| - return prefs->GetInteger(prefs::kNTPSyncPromoGroupMax) >=
|
| - prefs->GetInteger(prefs::kNTPSyncPromoGroup);
|
| + return prefs->GetInteger(prefs::kNTPSignInPromoGroupMax) >=
|
| + prefs->GetInteger(prefs::kNTPSignInPromoGroup);
|
| }
|
|
|