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

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: rename Ad->Notification 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 localized_strings.SetString("customlogo", 411 localized_strings.SetString("customlogo",
412 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoStart), 412 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoStart),
413 profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoEnd)) ? 413 profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoEnd)) ?
414 "true" : "false"); 414 "true" : "false");
415 } else { 415 } else {
416 localized_strings.SetString("customlogo", "false"); 416 localized_strings.SetString("customlogo", "false");
417 } 417 }
418 418
419 // If the user has preferences for a start and end time for a promo from 419 // If the user has preferences for a start and end time for a promo from
420 // the server, and this promo string exists, set the localized string. 420 // the server, and this promo string exists, set the localized string.
421 if (profile_->GetPrefs()->FindPreference(prefs::kNTPPromoStart) && 421 if (PromoResourceService::CanShowPromo(profile_)) {
jstritar 2011/09/15 15:42:27 nit: CanShowNotificationPromo
achuithb 2011/09/15 18:58:13 Done.
422 profile_->GetPrefs()->FindPreference(prefs::kNTPPromoEnd) && 422 localized_strings.SetString("serverpromo",
423 profile_->GetPrefs()->FindPreference(prefs::kNTPPromoLine) &&
424 PromoResourceServiceUtil::CanShowPromo(profile_) &&
425 InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPPromoStart),
426 profile_->GetPrefs()->GetDouble(prefs::kNTPPromoEnd))) {
427 localized_strings.SetString(
428 "serverpromo",
429 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); 423 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine));
430 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); 424 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown"));
431 } 425 }
432 426
433 // Load the new tab page appropriate for this build 427 // Load the new tab page appropriate for this build
434 // Note that some builds (eg. TOUCHUI) don't make use of everything we 428 // Note that some builds (eg. TOUCHUI) don't make use of everything we
435 // do here (all of the template data, etc.), but we keep the back end 429 // do here (all of the template data, etc.), but we keep the back end
436 // consistent across builds, supporting the union of all NTP front-ends 430 // consistent across builds, supporting the union of all NTP front-ends
437 // for simplicity. 431 // for simplicity.
438 std::string full_html; 432 std::string full_html;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; 584 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS;
591 static const base::StringPiece new_tab_theme_css( 585 static const base::StringPiece new_tab_theme_css(
592 ResourceBundle::GetSharedInstance().GetRawDataResource( 586 ResourceBundle::GetSharedInstance().GetRawDataResource(
593 ntp_css_resource_id)); 587 ntp_css_resource_id));
594 588
595 // Create the string from our template and the replacements. 589 // Create the string from our template and the replacements.
596 std::string css_string; 590 std::string css_string;
597 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 591 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
598 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 592 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
599 } 593 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698