Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 std::string anim = | 386 std::string anim = |
| 387 ui::Animation::ShouldRenderRichAnimation() ? "true" : "false"; | 387 ui::Animation::ShouldRenderRichAnimation() ? "true" : "false"; |
| 388 localized_strings.SetString("anim", anim); | 388 localized_strings.SetString("anim", anim); |
| 389 | 389 |
| 390 int alignment; | 390 int alignment; |
| 391 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 391 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
| 392 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); | 392 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); |
| 393 localized_strings.SetString("themegravity", | 393 localized_strings.SetString("themegravity", |
| 394 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); | 394 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); |
| 395 | 395 |
| 396 #if defined(ENABLE_PROMO_RESOURCE_SERVICE) | |
| 396 // If the user has preferences for a start and end time for a custom logo, | 397 // If the user has preferences for a start and end time for a custom logo, |
| 397 // and the time now is between these two times, show the custom logo. | 398 // and the time now is between these two times, show the custom logo. |
| 398 if (prefs->FindPreference(prefs::kNtpCustomLogoStart) && | 399 if (prefs->FindPreference(prefs::kNtpCustomLogoStart) && |
| 399 prefs->FindPreference(prefs::kNtpCustomLogoEnd)) { | 400 prefs->FindPreference(prefs::kNtpCustomLogoEnd)) { |
| 400 localized_strings.SetString("customlogo", | 401 localized_strings.SetString("customlogo", |
| 401 InDateRange(prefs->GetDouble(prefs::kNtpCustomLogoStart), | 402 InDateRange(prefs->GetDouble(prefs::kNtpCustomLogoStart), |
| 402 prefs->GetDouble(prefs::kNtpCustomLogoEnd)) ? | 403 prefs->GetDouble(prefs::kNtpCustomLogoEnd)) ? |
| 403 "true" : "false"); | 404 "true" : "false"); |
| 404 } else { | 405 } else { |
| 405 localized_strings.SetString("customlogo", "false"); | 406 localized_strings.SetString("customlogo", "false"); |
| 406 } | 407 } |
| 408 #else | |
| 409 localized_strings.SetString("customlogo", "false"); | |
| 410 #endif | |
| 407 | 411 |
| 412 #if defined(ENABLE_PROMO_RESOURCE_SERVICE) | |
| 408 // If the user has preferences for a start and end time for a promo from | 413 // If the user has preferences for a start and end time for a promo from |
|
Yaron
2012/04/09 20:38:55
Nit: Move this into the above if-clause.
Jerome
2012/04/09 22:17:31
Done.
| |
| 409 // the server, and this promo string exists, set the localized string. | 414 // the server, and this promo string exists, set the localized string. |
| 410 if (PromoResourceService::CanShowNotificationPromo(profile_)) { | 415 if (PromoResourceService::CanShowNotificationPromo(profile_)) { |
| 411 localized_strings.SetString("serverpromo", | 416 localized_strings.SetString("serverpromo", |
| 412 prefs->GetString(prefs::kNtpPromoLine)); | 417 prefs->GetString(prefs::kNtpPromoLine)); |
| 413 } | 418 } |
| 419 #endif | |
| 414 | 420 |
| 415 // Determine whether to show the menu for accessing tabs on other devices. | 421 // Determine whether to show the menu for accessing tabs on other devices. |
| 416 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( | 422 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 417 switches::kDisableNTPOtherSessionsMenu); | 423 switches::kDisableNTPOtherSessionsMenu); |
| 418 localized_strings.SetBoolean("showOtherSessionsMenu", | 424 localized_strings.SetBoolean("showOtherSessionsMenu", |
| 419 show_other_sessions_menu); | 425 show_other_sessions_menu); |
| 420 localized_strings.SetBoolean("isUserSignedIn", | 426 localized_strings.SetBoolean("isUserSignedIn", |
| 421 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); | 427 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); |
| 422 | 428 |
| 423 // Load the new tab page appropriate for this build | 429 // Load the new tab page appropriate for this build |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 // Get our template. | 554 // Get our template. |
| 549 static const base::StringPiece new_tab_theme_css( | 555 static const base::StringPiece new_tab_theme_css( |
| 550 ResourceBundle::GetSharedInstance().GetRawDataResource( | 556 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 551 IDR_NEW_TAB_4_THEME_CSS)); | 557 IDR_NEW_TAB_4_THEME_CSS)); |
| 552 | 558 |
| 553 // Create the string from our template and the replacements. | 559 // Create the string from our template and the replacements. |
| 554 std::string css_string; | 560 std::string css_string; |
| 555 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 561 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 556 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 562 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 557 } | 563 } |
| OLD | NEW |