OLD | NEW |
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 // If the user has preferences for a start and end time for a promo from | 414 // If the user has preferences for a start and end time for a promo from |
415 // the server, and this promo string exists, set the localized string. | 415 // the server, and this promo string exists, set the localized string. |
416 if (PromoResourceService::CanShowNotificationPromo(profile_)) { | 416 if (PromoResourceService::CanShowNotificationPromo(profile_)) { |
417 localized_strings.SetString("serverpromo", | 417 localized_strings.SetString("serverpromo", |
418 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); | 418 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); |
419 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); | 419 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); |
420 } | 420 } |
421 | 421 |
422 // Enable or disable bookmark features based on an about flag. | |
423 localized_strings.SetString("bookmark_features", | |
424 NewTabUI::NTP4BookmarkFeaturesEnabled() ? "true" : "false"); | |
425 | |
426 // Load the new tab page appropriate for this build | 422 // Load the new tab page appropriate for this build |
427 std::string full_html; | 423 std::string full_html; |
428 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 424 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
429 GetRawDataResource(IDR_NEW_TAB_4_HTML)); | 425 GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
430 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, | 426 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
431 &localized_strings); | 427 &localized_strings); |
432 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 428 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
433 } | 429 } |
434 | 430 |
435 void NTPResourceCache::CreateNewTabIncognitoCSS() { | 431 void NTPResourceCache::CreateNewTabIncognitoCSS() { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // Get our template. | 547 // Get our template. |
552 static const base::StringPiece new_tab_theme_css( | 548 static const base::StringPiece new_tab_theme_css( |
553 ResourceBundle::GetSharedInstance().GetRawDataResource( | 549 ResourceBundle::GetSharedInstance().GetRawDataResource( |
554 IDR_NEW_TAB_4_THEME_CSS)); | 550 IDR_NEW_TAB_4_THEME_CSS)); |
555 | 551 |
556 // Create the string from our template and the replacements. | 552 // Create the string from our template and the replacements. |
557 std::string css_string; | 553 std::string css_string; |
558 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 554 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
559 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 555 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
560 } | 556 } |
OLD | NEW |