Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 7655008: promo_resource_service fixes/cleanup for promos. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: unit test for UnpackPromoSignal reentrancy Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 profile_->GetPrefs()->FindPreference(prefs::kNTPCustomLogoEnd)) { 401 profile_->GetPrefs()->FindPreference(prefs::kNTPCustomLogoEnd)) {
402 localized_strings.SetString("customlogo", 402 localized_strings.SetString("customlogo",
403 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoStart), 403 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoStart),
404 profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoEnd)) ? 404 profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoEnd)) ?
405 "true" : "false"); 405 "true" : "false");
406 } else { 406 } else {
407 localized_strings.SetString("customlogo", "false"); 407 localized_strings.SetString("customlogo", "false");
408 } 408 }
409 409
410 // If the user has preferences for a start and end time for a promo from 410 // If the user has preferences for a start and end time for a promo from
411 // the server, and this promo string exists, set the localized string. 411 // the server, and this promo string exists, set the localized string.
jstritar 2011/08/24 20:13:37 This comment isn't all that relevant anymore... ma
412 if (profile_->GetPrefs()->FindPreference(prefs::kNTPPromoStart) && 412 if (PromoResourceService::CanShowPromo(profile_)) {
413 profile_->GetPrefs()->FindPreference(prefs::kNTPPromoEnd) && 413 localized_strings.SetString("serverpromo",
414 profile_->GetPrefs()->FindPreference(prefs::kNTPPromoLine) &&
415 PromoResourceServiceUtil::CanShowPromo(profile_) &&
416 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPPromoStart),
417 profile_->GetPrefs()->GetDouble(prefs::kNTPPromoEnd))) {
418 localized_strings.SetString(
419 "serverpromo",
420 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); 414 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine));
421 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); 415 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown"));
422 } else { 416 } else {
423 // Not showing a server-provided promo, so check if we need to show a 417 // Not showing a server-provided promo, so check if we need to show a
424 // notification from the sync service instead (don't want to show both). 418 // notification from the sync service instead (don't want to show both).
425 // If no notification is desired, the "syncNotification" attribute is set 419 // If no notification is desired, the "syncNotification" attribute is set
426 // to the empty string. 420 // to the empty string.
427 localized_strings.SetString("syncNotification", GetSyncTypeMessage()); 421 localized_strings.SetString("syncNotification", GetSyncTypeMessage());
428 } 422 }
429 423
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; 605 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS;
612 static const base::StringPiece new_tab_theme_css( 606 static const base::StringPiece new_tab_theme_css(
613 ResourceBundle::GetSharedInstance().GetRawDataResource( 607 ResourceBundle::GetSharedInstance().GetRawDataResource(
614 ntp_css_resource_id)); 608 ntp_css_resource_id));
615 609
616 // Create the string from our template and the replacements. 610 // Create the string from our template and the replacements.
617 std::string css_string; 611 std::string css_string;
618 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 612 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
619 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 613 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
620 } 614 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698