| 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" |
| 11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/extensions/extension_util.h" |
| 20 #include "chrome/browser/first_run/first_run.h" | 21 #include "chrome/browser/first_run/first_run.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/search/search.h" | 23 #include "chrome/browser/search/search.h" |
| 23 #include "chrome/browser/sync/profile_sync_service.h" | 24 #include "chrome/browser/sync/profile_sync_service.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/browser/themes/theme_properties.h" | 26 #include "chrome/browser/themes/theme_properties.h" |
| 26 #include "chrome/browser/themes/theme_service.h" | 27 #include "chrome/browser/themes/theme_service.h" |
| 27 #include "chrome/browser/themes/theme_service_factory.h" | 28 #include "chrome/browser/themes/theme_service_factory.h" |
| 28 #include "chrome/browser/ui/app_list/app_list_util.h" | 29 #include "chrome/browser/ui/app_list/app_list_util.h" |
| 29 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 30 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or | 484 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or |
| 484 // forward gesture. Pass through a flag that indicates whether or not that | 485 // forward gesture. Pass through a flag that indicates whether or not that |
| 485 // feature is enabled. | 486 // feature is enabled. |
| 486 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", | 487 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", |
| 487 is_swipe_tracking_from_scroll_events_enabled_); | 488 is_swipe_tracking_from_scroll_events_enabled_); |
| 488 | 489 |
| 489 load_time_data.SetBoolean("showApps", should_show_apps_page_); | 490 load_time_data.SetBoolean("showApps", should_show_apps_page_); |
| 490 load_time_data.SetBoolean("showWebStoreIcon", | 491 load_time_data.SetBoolean("showWebStoreIcon", |
| 491 !prefs->GetBoolean(prefs::kHideWebStoreIcon)); | 492 !prefs->GetBoolean(prefs::kHideWebStoreIcon)); |
| 492 | 493 |
| 493 bool streamlined_hosted_apps = CommandLine::ForCurrentProcess()->HasSwitch( | 494 bool streamlined_hosted_apps = |
| 494 switches::kEnableStreamlinedHostedApps); | 495 extensions::util::IsStreamlinedHostedAppsEnabled(); |
| 495 load_time_data.SetBoolean("enableStreamlinedHostedApps", | 496 load_time_data.SetBoolean("enableStreamlinedHostedApps", |
| 496 streamlined_hosted_apps); | 497 streamlined_hosted_apps); |
| 497 // Use a different string for launching as a regular tab for streamlined | 498 // Use a different string for launching as a regular tab for streamlined |
| 498 // hosted apps. | 499 // hosted apps. |
| 499 if (streamlined_hosted_apps) { | 500 if (streamlined_hosted_apps) { |
| 500 load_time_data.SetString("applaunchtypetab", | 501 load_time_data.SetString("applaunchtypetab", |
| 501 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_TAB)); | 502 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_TAB)); |
| 502 } | 503 } |
| 503 | 504 |
| 504 #if defined(OS_CHROMEOS) | 505 #if defined(OS_CHROMEOS) |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // Get our template. | 713 // Get our template. |
| 713 static const base::StringPiece new_tab_theme_css( | 714 static const base::StringPiece new_tab_theme_css( |
| 714 ResourceBundle::GetSharedInstance().GetRawDataResource( | 715 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 715 IDR_NEW_TAB_4_THEME_CSS)); | 716 IDR_NEW_TAB_4_THEME_CSS)); |
| 716 | 717 |
| 717 // Create the string from our template and the replacements. | 718 // Create the string from our template and the replacements. |
| 718 std::string css_string; | 719 std::string css_string; |
| 719 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 720 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 720 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 721 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 721 } | 722 } |
| OLD | NEW |