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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 // Control fade and resize animations. | 401 // Control fade and resize animations. |
402 load_time_data.SetBoolean("anim", ui::Animation::ShouldRenderRichAnimation()); | 402 load_time_data.SetBoolean("anim", ui::Animation::ShouldRenderRichAnimation()); |
403 | 403 |
404 int alignment; | 404 int alignment; |
405 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 405 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
406 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); | 406 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); |
407 load_time_data.SetString("themegravity", | 407 load_time_data.SetString("themegravity", |
408 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); | 408 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); |
409 | 409 |
410 #if defined(ENABLE_PROMO_RESOURCE_SERVICE) | |
411 // 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 |
412 // the server, and this promo string exists, set the localized string. | 411 // the server, and this promo string exists, set the localized string. |
413 if (PromoResourceService::CanShowNotificationPromo(profile_)) { | 412 if (PromoResourceService::CanShowNotificationPromo(profile_)) { |
414 load_time_data.SetString("serverpromo", | 413 load_time_data.SetString("serverpromo", |
415 prefs->GetString(prefs::kNtpPromoLine)); | 414 prefs->GetString(prefs::kNtpPromoLine)); |
416 } | 415 } |
417 #endif | |
418 | 416 |
419 // Determine whether to show the menu for accessing tabs on other devices. | 417 // Determine whether to show the menu for accessing tabs on other devices. |
420 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( | 418 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( |
421 switches::kDisableNTPOtherSessionsMenu); | 419 switches::kDisableNTPOtherSessionsMenu); |
422 load_time_data.SetBoolean("showOtherSessionsMenu", | 420 load_time_data.SetBoolean("showOtherSessionsMenu", |
423 show_other_sessions_menu); | 421 show_other_sessions_menu); |
424 load_time_data.SetBoolean("isUserSignedIn", | 422 load_time_data.SetBoolean("isUserSignedIn", |
425 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); | 423 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); |
426 | 424 |
427 // Load the new tab page appropriate for this build | 425 // Load the new tab page appropriate for this build |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 ResourceBundle::GetSharedInstance().GetRawDataResource( | 554 ResourceBundle::GetSharedInstance().GetRawDataResource( |
557 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? | 555 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? |
558 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS, | 556 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS, |
559 ui::SCALE_FACTOR_NONE)); | 557 ui::SCALE_FACTOR_NONE)); |
560 | 558 |
561 // Create the string from our template and the replacements. | 559 // Create the string from our template and the replacements. |
562 std::string css_string; | 560 std::string css_string; |
563 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 561 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
564 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 562 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
565 } | 563 } |
OLD | NEW |