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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 422 |
423 int alignment; | 423 int alignment; |
424 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 424 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
425 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); | 425 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment); |
426 load_time_data.SetString("themegravity", | 426 load_time_data.SetString("themegravity", |
427 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); | 427 (alignment & ThemeService::ALIGN_RIGHT) ? "right" : ""); |
428 | 428 |
429 // Disable the promo if this is the first run, otherwise set the promo string | 429 // Disable the promo if this is the first run, otherwise set the promo string |
430 // for display if there is a valid outstanding promo. | 430 // for display if there is a valid outstanding promo. |
431 if (first_run::IsChromeFirstRun()) { | 431 if (first_run::IsChromeFirstRun()) { |
432 NotificationPromo::HandleClosed(profile_, | 432 NotificationPromo::HandleClosed(NotificationPromo::NTP_NOTIFICATION_PROMO); |
433 NotificationPromo::NTP_NOTIFICATION_PROMO); | |
434 } else { | 433 } else { |
435 NotificationPromo notification_promo(profile_); | 434 NotificationPromo notification_promo; |
436 notification_promo.InitFromPrefs(NotificationPromo::NTP_NOTIFICATION_PROMO); | 435 notification_promo.InitFromPrefs(NotificationPromo::NTP_NOTIFICATION_PROMO); |
437 if (notification_promo.CanShow()) { | 436 if (notification_promo.CanShow()) { |
438 load_time_data.SetString("notificationPromoText", | 437 load_time_data.SetString("notificationPromoText", |
439 notification_promo.promo_text()); | 438 notification_promo.promo_text()); |
440 DVLOG(1) << "Notification promo:" << notification_promo.promo_text(); | 439 DVLOG(1) << "Notification promo:" << notification_promo.promo_text(); |
441 } | 440 } |
442 | 441 |
443 NotificationPromo bubble_promo(profile_); | 442 NotificationPromo bubble_promo; |
444 bubble_promo.InitFromPrefs(NotificationPromo::NTP_BUBBLE_PROMO); | 443 bubble_promo.InitFromPrefs(NotificationPromo::NTP_BUBBLE_PROMO); |
445 if (bubble_promo.CanShow()) { | 444 if (bubble_promo.CanShow()) { |
446 load_time_data.SetString("bubblePromoText", | 445 load_time_data.SetString("bubblePromoText", |
447 bubble_promo.promo_text()); | 446 bubble_promo.promo_text()); |
448 DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text(); | 447 DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text(); |
449 } | 448 } |
450 } | 449 } |
451 | 450 |
452 // Determine whether to show the menu for accessing tabs on other devices. | 451 // Determine whether to show the menu for accessing tabs on other devices. |
453 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( | 452 bool show_other_sessions_menu = !CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 // Get our template. | 589 // Get our template. |
591 static const base::StringPiece new_tab_theme_css( | 590 static const base::StringPiece new_tab_theme_css( |
592 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ? | 591 ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ? |
593 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); | 592 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); |
594 | 593 |
595 // Create the string from our template and the replacements. | 594 // Create the string from our template and the replacements. |
596 std::string css_string; | 595 std::string css_string; |
597 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 596 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
598 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 597 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
599 } | 598 } |
OLD | NEW |