Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
index 3baf8ef6718965398b00091ff718851cd578174d..48064ef87faba439af6b2c254ebf485b4e74fb42 100644 |
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
@@ -18,7 +18,6 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/extensions/extension_util.h" |
-#include "chrome/browser/first_run/first_run.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/search/search.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
@@ -33,7 +32,6 @@ |
#include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
#include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" |
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
-#include "chrome/browser/web_resource/notification_promo_helper.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
@@ -46,7 +44,6 @@ |
#include "components/prefs/pref_service.h" |
#include "components/signin/core/browser/signin_manager.h" |
#include "components/strings/grit/components_strings.h" |
-#include "components/web_resource/notification_promo.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/render_process_host.h" |
@@ -173,15 +170,6 @@ NTPResourceCache::NTPResourceCache(Profile* profile) |
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
content::Source<ThemeService>( |
ThemeServiceFactory::GetForProfile(profile))); |
- registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
- content::NotificationService::AllSources()); |
- |
- web_resource::PromoResourceService* promo_service = |
- g_browser_process->promo_resource_service(); |
- if (promo_service) { |
- promo_resource_subscription_ = promo_service->RegisterStateChangedCallback( |
- base::Bind(&NTPResourceCache::Invalidate, base::Unretained(this))); |
- } |
base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, |
base::Unretained(this)); |
@@ -283,12 +271,10 @@ void NTPResourceCache::Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
// Invalidate the cache. |
- if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type || |
- chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) { |
+ if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type) |
Invalidate(); |
- } else { |
+ else |
NOTREACHED(); |
- } |
} |
void NTPResourceCache::OnPreferenceChanged() { |
@@ -299,11 +285,11 @@ void NTPResourceCache::OnPreferenceChanged() { |
new_tab_css_ = NULL; |
} |
+// TODO(dbeam): why must Invalidate() and OnPreferenceChanged() both exist? |
void NTPResourceCache::Invalidate() { |
new_tab_incognito_html_ = nullptr; |
new_tab_html_ = nullptr; |
new_tab_incognito_css_ = nullptr; |
- // TODO(dbeam): Check if it is necessary to clear the CSS on promo changes. |
new_tab_css_ = nullptr; |
} |
@@ -502,33 +488,6 @@ void NTPResourceCache::CreateNewTabHTML() { |
load_time_data.SetBoolean("anim", |
gfx::Animation::ShouldRenderRichAnimation()); |
- // Disable the promo if this is the first run, otherwise set the promo string |
- // for display if there is a valid outstanding promo. |
- if (first_run::IsChromeFirstRun()) { |
- web_resource::HandleNotificationPromoClosed( |
- web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO); |
- } else { |
- web_resource::NotificationPromo notification_promo( |
- g_browser_process->local_state()); |
- notification_promo.InitFromPrefs( |
- web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO); |
- if (notification_promo.CanShow()) { |
- load_time_data.SetString("notificationPromoText", |
- notification_promo.promo_text()); |
- DVLOG(1) << "Notification promo:" << notification_promo.promo_text(); |
- } |
- |
- web_resource::NotificationPromo bubble_promo( |
- g_browser_process->local_state()); |
- bubble_promo.InitFromPrefs( |
- web_resource::NotificationPromo::NTP_BUBBLE_PROMO); |
- if (bubble_promo.CanShow()) { |
- load_time_data.SetString("bubblePromoText", |
- bubble_promo.promo_text()); |
- DVLOG(1) << "Bubble promo:" << bubble_promo.promo_text(); |
- } |
- } |
- |
load_time_data.SetBoolean( |
"isUserSignedIn", |
SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()); |