| 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 "apps/app_launcher.h" | 10 #include "apps/app_launcher.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 44 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 45 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
| 47 #include "grit/browser_resources.h" | 47 #include "grit/browser_resources.h" |
| 48 #include "grit/chromium_strings.h" | 48 #include "grit/chromium_strings.h" |
| 49 #include "grit/generated_resources.h" | 49 #include "grit/generated_resources.h" |
| 50 #include "grit/locale_settings.h" | 50 #include "grit/locale_settings.h" |
| 51 #include "grit/theme_resources.h" | 51 #include "grit/theme_resources.h" |
| 52 #include "ui/base/animation/animation.h" | |
| 53 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
| 54 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
| 55 #include "ui/base/theme_provider.h" | 54 #include "ui/base/theme_provider.h" |
| 55 #include "ui/gfx/animation/animation.h" |
| 56 #include "ui/gfx/color_utils.h" | 56 #include "ui/gfx/color_utils.h" |
| 57 #include "ui/gfx/sys_color_change_listener.h" | 57 #include "ui/gfx/sys_color_change_listener.h" |
| 58 #include "ui/webui/jstemplate_builder.h" | 58 #include "ui/webui/jstemplate_builder.h" |
| 59 #include "ui/webui/web_ui_util.h" | 59 #include "ui/webui/web_ui_util.h" |
| 60 | 60 |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 #include "chromeos/chromeos_switches.h" | 62 #include "chromeos/chromeos_switches.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 load_time_data.SetString("expandMenu", | 495 load_time_data.SetString("expandMenu", |
| 496 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 496 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
| 497 #endif | 497 #endif |
| 498 | 498 |
| 499 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); | 499 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); |
| 500 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); | 500 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); |
| 501 | 501 |
| 502 webui::SetFontAndTextDirection(&load_time_data); | 502 webui::SetFontAndTextDirection(&load_time_data); |
| 503 | 503 |
| 504 // Control fade and resize animations. | 504 // Control fade and resize animations. |
| 505 load_time_data.SetBoolean("anim", ui::Animation::ShouldRenderRichAnimation()); | 505 load_time_data.SetBoolean("anim", |
| 506 gfx::Animation::ShouldRenderRichAnimation()); |
| 506 | 507 |
| 507 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 508 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
| 508 int alignment = tp->GetDisplayProperty( | 509 int alignment = tp->GetDisplayProperty( |
| 509 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); | 510 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); |
| 510 load_time_data.SetString("themegravity", | 511 load_time_data.SetString("themegravity", |
| 511 (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : ""); | 512 (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : ""); |
| 512 | 513 |
| 513 // Disable the promo if this is the first run, otherwise set the promo string | 514 // Disable the promo if this is the first run, otherwise set the promo string |
| 514 // for display if there is a valid outstanding promo. | 515 // for display if there is a valid outstanding promo. |
| 515 if (first_run::IsChromeFirstRun()) { | 516 if (first_run::IsChromeFirstRun()) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 // Get our template. | 702 // Get our template. |
| 702 static const base::StringPiece new_tab_theme_css( | 703 static const base::StringPiece new_tab_theme_css( |
| 703 ResourceBundle::GetSharedInstance().GetRawDataResource( | 704 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 704 IDR_NEW_TAB_4_THEME_CSS)); | 705 IDR_NEW_TAB_4_THEME_CSS)); |
| 705 | 706 |
| 706 // Create the string from our template and the replacements. | 707 // Create the string from our template and the replacements. |
| 707 std::string css_string; | 708 std::string css_string; |
| 708 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 709 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 709 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 710 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 710 } | 711 } |
| OLD | NEW |