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" |
11 #include "apps/field_trial_names.h" | |
12 #include "apps/pref_names.h" | 11 #include "apps/pref_names.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
15 #include "base/metrics/field_trial.h" | |
16 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
17 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
18 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
21 #include "base/values.h" | 19 #include "base/values.h" |
22 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/first_run/first_run.h" | 21 #include "chrome/browser/first_run/first_run.h" |
24 #include "chrome/browser/google/google_util.h" | 22 #include "chrome/browser/google/google_util.h" |
25 #include "chrome/browser/policy/browser_policy_connector.h" | 23 #include "chrome/browser/policy/browser_policy_connector.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // profile is not the default. | 337 // profile is not the default. |
340 PrefService* prefs = profile_->GetPrefs(); | 338 PrefService* prefs = profile_->GetPrefs(); |
341 PrefService* local_state = g_browser_process->local_state(); | 339 PrefService* local_state = g_browser_process->local_state(); |
342 DictionaryValue load_time_data; | 340 DictionaryValue load_time_data; |
343 load_time_data.SetBoolean("bookmarkbarattached", | 341 load_time_data.SetBoolean("bookmarkbarattached", |
344 prefs->GetBoolean(prefs::kShowBookmarkBar)); | 342 prefs->GetBoolean(prefs::kShowBookmarkBar)); |
345 load_time_data.SetBoolean("hasattribution", | 343 load_time_data.SetBoolean("hasattribution", |
346 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( | 344 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( |
347 IDR_THEME_NTP_ATTRIBUTION)); | 345 IDR_THEME_NTP_ATTRIBUTION)); |
348 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); | 346 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); |
349 std::string app_launcher_promo_group_name = | 347 load_time_data.SetBoolean("showAppLauncherPromo", |
350 base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName); | 348 apps::ShouldShowAppLauncherPromo()); |
351 bool show_app_launcher_promo = | |
352 !apps::IsAppLauncherEnabled() && | |
353 local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo) && | |
354 (app_launcher_promo_group_name == apps::kShowLauncherPromoOnceGroupName || | |
355 app_launcher_promo_group_name == | |
356 apps::kResetShowLauncherPromoPrefGroupName); | |
357 load_time_data.SetBoolean("showAppLauncherPromo", show_app_launcher_promo); | |
358 load_time_data.SetBoolean("showRecentlyClosed", | 349 load_time_data.SetBoolean("showRecentlyClosed", |
359 should_show_recently_closed_menu_); | 350 should_show_recently_closed_menu_); |
360 load_time_data.SetString("title", | 351 load_time_data.SetString("title", |
361 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 352 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
362 load_time_data.SetString("mostvisited", | 353 load_time_data.SetString("mostvisited", |
363 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); | 354 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); |
364 load_time_data.SetString("suggestions", | 355 load_time_data.SetString("suggestions", |
365 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS)); | 356 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS)); |
366 load_time_data.SetString("restoreThumbnailsShort", | 357 load_time_data.SetString("restoreThumbnailsShort", |
367 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); | 358 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 // Get our template. | 619 // Get our template. |
629 static const base::StringPiece new_tab_theme_css( | 620 static const base::StringPiece new_tab_theme_css( |
630 ResourceBundle::GetSharedInstance().GetRawDataResource( | 621 ResourceBundle::GetSharedInstance().GetRawDataResource( |
631 IDR_NEW_TAB_4_THEME_CSS)); | 622 IDR_NEW_TAB_4_THEME_CSS)); |
632 | 623 |
633 // Create the string from our template and the replacements. | 624 // Create the string from our template and the replacements. |
634 std::string css_string; | 625 std::string css_string; |
635 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 626 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
636 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 627 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
637 } | 628 } |
OLD | NEW |