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 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
#include <string>
#include <vector> #include <vector>
#include "base/command_line.h" #include "base/command_line.h"
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
#include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" #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_promo/sync_promo_ui.h"
#include "chrome/browser/ui/webui/sync_setup_handler.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_notification_types.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension.h"
...@@ -407,12 +408,11 @@ void NTPResourceCache::CreateNewTabHTML() { ...@@ -407,12 +408,11 @@ void NTPResourceCache::CreateNewTabHTML() {
load_time_data.SetString("themegravity", load_time_data.SetString("themegravity",
(alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); (alignment & ThemeService::ALIGN_RIGHT) ? "right" : "");
// If the user has preferences for a start and end time for a promo from // Set the promo string for display if there is a valid outstanding promo.
// the server, and this promo string exists, set the localized string. NotificationPromo notification_promo(profile_);
if (PromoResourceService::CanShowNotificationPromo(profile_)) { notification_promo.InitFromPrefs();
load_time_data.SetString("serverpromo", if (notification_promo.CanShow())
prefs->GetString(prefs::kNtpPromoLine)); load_time_data.SetString("serverpromo", notification_promo.promo_text());
}
// Determine whether to show the menu for accessing tabs on other devices. // Determine whether to show the menu for accessing tabs on other devices.
bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch(
......
...@@ -355,6 +355,7 @@ void NotificationPromo::CheckForNewNotification() { ...@@ -355,6 +355,7 @@ void NotificationPromo::CheckForNewNotification() {
} }
void NotificationPromo::OnNewNotification() { void NotificationPromo::OnNewNotification() {
DVLOG(1) << "OnNewNotification";
// Create a new promo group. // Create a new promo group.
group_ = base::RandInt(0, num_groups_ - 1); group_ = base::RandInt(0, num_groups_ - 1);
WritePrefs(); WritePrefs();
......
...@@ -186,9 +186,3 @@ void PromoResourceService::Unpack(const DictionaryValue& parsed_json) { ...@@ -186,9 +186,3 @@ void PromoResourceService::Unpack(const DictionaryValue& parsed_json) {
notification_promo.EndTime()); 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; ...@@ -24,9 +24,6 @@ class Profile;
// promotional messages to certain groups of Chrome users. // promotional messages to certain groups of Chrome users.
class PromoResourceService : public WebResourceService { class PromoResourceService : public WebResourceService {
public: public:
// Checks for conditions to show promo.
static bool CanShowNotificationPromo(Profile* profile);
static void RegisterPrefs(PrefService* local_state); static void RegisterPrefs(PrefService* local_state);
static void RegisterUserPrefs(PrefService* prefs); 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