diff options
author | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-31 20:21:09 +0000 |
---|---|---|
committer | achuith@chromium.org <achuith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-31 20:21:09 +0000 |
commit | 82814c6b477a3259dd7220b06b844fbfa660c7f3 (patch) | |
tree | fec9bb465d3e6e168828ba07676463b31cbd8ed3 | |
parent | f2645358dce7dabad51ca9aeb305fef6eccae8c6 (diff) | |
download | chromium_src-82814c6b477a3259dd7220b06b844fbfa660c7f3.zip chromium_src-82814c6b477a3259dd7220b06b844fbfa660c7f3.tar.gz chromium_src-82814c6b477a3259dd7220b06b844fbfa660c7f3.tar.bz2 |
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
4 files changed, 10 insertions, 18 deletions
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 61c5943..837bd66 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -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( @@ -537,9 +537,9 @@ void NTPResourceCache::CreateNewTabCSS() { subst.push_back(SkColorToRGBAString(color_section_link)); // $13 subst.push_back(SkColorToRGBAString(color_link_underline)); // $14 subst.push_back(SkColorToRGBAString(color_section_link_underline)); // $15 - subst.push_back(SkColorToRGBAString(color_section_header_text)); // $16 + subst.push_back(SkColorToRGBAString(color_section_header_text)); // $16 subst.push_back(SkColorToRGBAString( - color_section_header_text_hover)); // $17 + color_section_header_text_hover)); // $17 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18 subst.push_back(SkColorToRGBAString( color_section_header_rule_light)); // $19 diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index e10fa0b..9dc8f40 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -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(); diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc index c4f0948..9a7b6002 100644 --- a/chrome/browser/web_resource/promo_resource_service.cc +++ b/chrome/browser/web_resource/promo_resource_service.cc @@ -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(); -} diff --git a/chrome/browser/web_resource/promo_resource_service.h b/chrome/browser/web_resource/promo_resource_service.h index 0fabb52..a271b1d 100644 --- a/chrome/browser/web_resource/promo_resource_service.h +++ b/chrome/browser/web_resource/promo_resource_service.h @@ -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); |