| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/themes/theme_service.h" | 26 #include "chrome/browser/themes/theme_service.h" |
| 27 #include "chrome/browser/themes/theme_service_factory.h" | 27 #include "chrome/browser/themes/theme_service_factory.h" |
| 28 #include "chrome/browser/ui/app_list/app_list_util.h" | 28 #include "chrome/browser/ui/app_list/app_list_util.h" |
| 29 #include "chrome/browser/ui/apps/app_info_dialog.h" | 29 #include "chrome/browser/ui/apps/app_info_dialog.h" |
| 30 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 30 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 31 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 31 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| 32 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" | 32 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
| 33 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 33 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 34 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 34 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/features.h" |
| 36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 37 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 38 #include "chrome/grit/browser_resources.h" | 39 #include "chrome/grit/browser_resources.h" |
| 39 #include "chrome/grit/chromium_strings.h" | 40 #include "chrome/grit/chromium_strings.h" |
| 40 #include "chrome/grit/generated_resources.h" | 41 #include "chrome/grit/generated_resources.h" |
| 41 #include "chrome/grit/locale_settings.h" | 42 #include "chrome/grit/locale_settings.h" |
| 42 #include "chrome/grit/theme_resources.h" | 43 #include "chrome/grit/theme_resources.h" |
| 43 #include "components/bookmarks/common/bookmark_pref_names.h" | 44 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 44 #include "components/browser_sync/profile_sync_service.h" | 45 #include "components/browser_sync/profile_sync_service.h" |
| 45 #include "components/google/core/browser/google_util.h" | 46 #include "components/google/core/browser/google_util.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 177 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
| 177 profile_pref_change_registrar_.Init(profile_->GetPrefs()); | 178 profile_pref_change_registrar_.Init(profile_->GetPrefs()); |
| 178 profile_pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar, | 179 profile_pref_change_registrar_.Add(bookmarks::prefs::kShowBookmarkBar, |
| 179 callback); | 180 callback); |
| 180 profile_pref_change_registrar_.Add(prefs::kNtpShownPage, callback); | 181 profile_pref_change_registrar_.Add(prefs::kNtpShownPage, callback); |
| 181 profile_pref_change_registrar_.Add(prefs::kSignInPromoShowNTPBubble, | 182 profile_pref_change_registrar_.Add(prefs::kSignInPromoShowNTPBubble, |
| 182 callback); | 183 callback); |
| 183 profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback); | 184 profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback); |
| 184 | 185 |
| 185 // Some tests don't have a local state. | 186 // Some tests don't have a local state. |
| 186 #if defined(ENABLE_APP_LIST) | 187 #if BUILDFLAG(ENABLE_APP_LIST) |
| 187 if (g_browser_process->local_state()) { | 188 if (g_browser_process->local_state()) { |
| 188 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); | 189 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); |
| 189 local_state_pref_change_registrar_.Add(prefs::kShowAppLauncherPromo, | 190 local_state_pref_change_registrar_.Add(prefs::kShowAppLauncherPromo, |
| 190 callback); | 191 callback); |
| 191 local_state_pref_change_registrar_.Add( | 192 local_state_pref_change_registrar_.Add( |
| 192 prefs::kAppLauncherHasBeenEnabled, callback); | 193 prefs::kAppLauncherHasBeenEnabled, callback); |
| 193 } | 194 } |
| 194 #endif | 195 #endif |
| 195 } | 196 } |
| 196 | 197 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // Get our template. | 603 // Get our template. |
| 603 static const base::StringPiece new_tab_theme_css( | 604 static const base::StringPiece new_tab_theme_css( |
| 604 ResourceBundle::GetSharedInstance().GetRawDataResource( | 605 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 605 IDR_NEW_TAB_4_THEME_CSS)); | 606 IDR_NEW_TAB_4_THEME_CSS)); |
| 606 | 607 |
| 607 // Create the string from our template and the replacements. | 608 // Create the string from our template and the replacements. |
| 608 std::string css_string = | 609 std::string css_string = |
| 609 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 610 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
| 610 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 611 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 611 } | 612 } |
| OLD | NEW |