OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/ui/webui/sync_promo_ui.h" | 29 #include "chrome/browser/ui/webui/sync_promo_ui.h" |
30 #include "chrome/browser/ui/webui/sync_setup_handler.h" | 30 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
31 #include "chrome/browser/web_resource/promo_resource_service.h" | 31 #include "chrome/browser/web_resource/promo_resource_service.h" |
32 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/extensions/extension.h" | 34 #include "chrome/common/extensions/extension.h" |
35 #include "chrome/common/extensions/extension_constants.h" | 35 #include "chrome/common/extensions/extension_constants.h" |
36 #include "chrome/common/jstemplate_builder.h" | 36 #include "chrome/common/jstemplate_builder.h" |
37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
38 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
39 #include "content/browser/user_metrics.h" | |
40 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
42 #include "grit/browser_resources.h" | 41 #include "grit/browser_resources.h" |
43 #include "grit/chromium_strings.h" | 42 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
45 #include "grit/locale_settings.h" | 44 #include "grit/locale_settings.h" |
46 #include "grit/theme_resources.h" | 45 #include "grit/theme_resources.h" |
47 #include "ui/base/animation/animation.h" | 46 #include "ui/base/animation/animation.h" |
48 #include "ui/base/l10n/l10n_util.h" | 47 #include "ui/base/l10n/l10n_util.h" |
49 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 "true" : "false"); | 370 "true" : "false"); |
372 } else { | 371 } else { |
373 localized_strings.SetString("customlogo", "false"); | 372 localized_strings.SetString("customlogo", "false"); |
374 } | 373 } |
375 | 374 |
376 // If the user has preferences for a start and end time for a promo from | 375 // If the user has preferences for a start and end time for a promo from |
377 // the server, and this promo string exists, set the localized string. | 376 // the server, and this promo string exists, set the localized string. |
378 if (PromoResourceService::CanShowNotificationPromo(profile_)) { | 377 if (PromoResourceService::CanShowNotificationPromo(profile_)) { |
379 localized_strings.SetString("serverpromo", | 378 localized_strings.SetString("serverpromo", |
380 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); | 379 profile_->GetPrefs()->GetString(prefs::kNTPPromoLine)); |
381 UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); | |
382 } | 380 } |
383 | 381 |
384 // Load the new tab page appropriate for this build | 382 // Load the new tab page appropriate for this build |
385 std::string full_html; | 383 std::string full_html; |
386 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 384 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
387 GetRawDataResource(IDR_NEW_TAB_4_HTML)); | 385 GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
388 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, | 386 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
389 &localized_strings); | 387 &localized_strings); |
390 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 388 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
391 } | 389 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // Get our template. | 507 // Get our template. |
510 static const base::StringPiece new_tab_theme_css( | 508 static const base::StringPiece new_tab_theme_css( |
511 ResourceBundle::GetSharedInstance().GetRawDataResource( | 509 ResourceBundle::GetSharedInstance().GetRawDataResource( |
512 IDR_NEW_TAB_4_THEME_CSS)); | 510 IDR_NEW_TAB_4_THEME_CSS)); |
513 | 511 |
514 // Create the string from our template and the replacements. | 512 // Create the string from our template and the replacements. |
515 std::string css_string; | 513 std::string css_string; |
516 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 514 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
517 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 515 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
518 } | 516 } |
OLD | NEW |