Commit 82814c6b authored by achuith@chromium.org's avatar achuith@chromium.org

Fix regression due to deprecated promo preference.

148013 introduced a regression where the promo text was not being set, because it referred to a deprecated promo pref.

BUG=123061
TEST=manual.

Review URL: https://chromiumcodereview.appspot.com/10825093

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149264 0039d316-1c4b-4281-b951-d872f2087c98
parent f2645358
......@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include <string>
#include <vector>
#include "base/command_line.h"
......@@ -29,7 +30,7 @@
#include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
#include "chrome/browser/ui/webui/sync_setup_handler.h"
#include "chrome/browser/web_resource/promo_resource_service.h"
#include "chrome/browser/web_resource/notification_promo.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
......@@ -407,12 +408,11 @@ void NTPResourceCache::CreateNewTabHTML() {
load_time_data.SetString("themegravity",
(alignment & ThemeService::ALIGN_RIGHT) ? "right" : "");
// If the user has preferences for a start and end time for a promo from
// the server, and this promo string exists, set the localized string.
if (PromoResourceService::CanShowNotificationPromo(profile_)) {
load_time_data.SetString("serverpromo",
prefs->GetString(prefs::kNtpPromoLine));
}
// Set the promo string for display if there is a valid outstanding promo.
NotificationPromo notification_promo(profile_);
notification_promo.InitFromPrefs();
if (notification_promo.CanShow())
load_time_data.SetString("serverpromo", notification_promo.promo_text());
// Determine whether to show the menu for accessing tabs on other devices.
bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch(
......
......@@ -355,6 +355,7 @@ void NotificationPromo::CheckForNewNotification() {
}
void NotificationPromo::OnNewNotification() {
DVLOG(1) << "OnNewNotification";
// Create a new promo group.
group_ = base::RandInt(0, num_groups_ - 1);
WritePrefs();
......
......@@ -186,9 +186,3 @@ void PromoResourceService::Unpack(const DictionaryValue& parsed_json) {
notification_promo.EndTime());
}
}
bool PromoResourceService::CanShowNotificationPromo(Profile* profile) {
NotificationPromo notification_promo(profile);
notification_promo.InitFromPrefs();
return notification_promo.CanShow();
}
......@@ -24,9 +24,6 @@ class Profile;
// promotional messages to certain groups of Chrome users.
class PromoResourceService : public WebResourceService {
public:
// Checks for conditions to show promo.
static bool CanShowNotificationPromo(Profile* profile);
static void RegisterPrefs(PrefService* local_state);
static void RegisterUserPrefs(PrefService* prefs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment