| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); | 414 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); |
| 415 | 415 |
| 416 // Disable the promo if this is the first run, otherwise set the promo string | 416 // Disable the promo if this is the first run, otherwise set the promo string |
| 417 // for display if there is a valid outstanding promo. | 417 // for display if there is a valid outstanding promo. |
| 418 if (first_run::IsChromeFirstRun()) { | 418 if (first_run::IsChromeFirstRun()) { |
| 419 NotificationPromo::HandleClosed(profile_, | 419 NotificationPromo::HandleClosed(profile_, |
| 420 NotificationPromo::NTP_NOTIFICATION_PROMO); | 420 NotificationPromo::NTP_NOTIFICATION_PROMO); |
| 421 } else { | 421 } else { |
| 422 NotificationPromo notification_promo(profile_); | 422 NotificationPromo notification_promo(profile_); |
| 423 notification_promo.InitFromPrefs(NotificationPromo::NTP_NOTIFICATION_PROMO); | 423 notification_promo.InitFromPrefs(NotificationPromo::NTP_NOTIFICATION_PROMO); |
| 424 if (notification_promo.CanShow()) | 424 if (notification_promo.CanShow()) { |
| 425 load_time_data.SetString("serverpromo", notification_promo.promo_text()); | 425 load_time_data.SetString("notificationPromoText", |
| 426 notification_promo.promo_text()); |
| 427 DVLOG(1) << "Notification promo:" << notification_promo.promo_text(); |
| 428 } |
| 429 |
| 430 NotificationPromo bubble_promo(profile_); |
| 431 bubble_promo.InitFromPrefs(NotificationPromo::NTP_BUBBLE_PROMO); |
| 432 if (bubble_promo.CanShow()) { |
| 433 load_time_data.SetString("bubblePromoText", |
| 434 bubble_promo.promo_text()); |
| 435 DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text(); |
| 436 } |
| 426 } | 437 } |
| 427 | 438 |
| 428 // Determine whether to show the menu for accessing tabs on other devices. | 439 // Determine whether to show the menu for accessing tabs on other devices. |
| 429 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( | 440 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 430 switches::kDisableNTPOtherSessionsMenu); | 441 switches::kDisableNTPOtherSessionsMenu); |
| 431 load_time_data.SetBoolean("showOtherSessionsMenu", | 442 load_time_data.SetBoolean("showOtherSessionsMenu", |
| 432 show_other_sessions_menu); | 443 show_other_sessions_menu); |
| 433 load_time_data.SetBoolean("isUserSignedIn", | 444 load_time_data.SetBoolean("isUserSignedIn", |
| 434 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); | 445 !prefs->GetString(prefs::kGoogleServicesUsername).empty()); |
| 435 | 446 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 ResourceBundle::GetSharedInstance().GetRawDataResource( | 576 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 566 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? | 577 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? |
| 567 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS, | 578 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS, |
| 568 ui::SCALE_FACTOR_NONE)); | 579 ui::SCALE_FACTOR_NONE)); |
| 569 | 580 |
| 570 // Create the string from our template and the replacements. | 581 // Create the string from our template and the replacements. |
| 571 std::string css_string; | 582 std::string css_string; |
| 572 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 583 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 573 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 584 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 574 } | 585 } |
| OLD | NEW |