Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1313)

Unified Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 5750005: Default apps promo was getting expired early if NTP open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/default_apps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/app_launcher_handler.cc
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 333b77d980c4b736f8ac3e677652a4c3a352027e..b63f573186860d958179945e6fbaabb12c8af1d9 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -181,16 +181,6 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
}
dictionary->Set("apps", list);
- DefaultApps* default_apps = extensions_service_->default_apps();
- if (default_apps->ShouldShowPromo(extensions_service_->GetAppIds())) {
- dictionary->SetBoolean("showPromo", true);
- default_apps->DidShowPromo();
- promo_active_ = true;
- } else {
- dictionary->SetBoolean("showPromo", false);
- promo_active_ = false;
- }
-
bool showLauncher =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppLauncher);
dictionary->SetBoolean("showLauncher", showLauncher);
@@ -205,6 +195,25 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
void AppLauncherHandler::HandleGetApps(const ListValue* args) {
DictionaryValue dictionary;
FillAppDictionary(&dictionary);
+
+ // Tell the client whether to show the promo for this view. We don't do this
+ // in the case of PREF_CHANGED because:
+ //
+ // a) At that point in time, depending on the pref that changed, it can look
+ // like the set of apps installed has changed, and we will mark the promo
+ // expired.
+ // b) Conceptually, it doesn't really make sense to count a
+ // prefchange-triggered refresh as a promo 'view'.
+ DefaultApps* default_apps = extensions_service_->default_apps();
+ if (default_apps->CheckShouldShowPromo(extensions_service_->GetAppIds())) {
+ dictionary.SetBoolean("showPromo", true);
+ default_apps->DidShowPromo();
+ promo_active_ = true;
+ } else {
+ dictionary.SetBoolean("showPromo", false);
+ promo_active_ = false;
+ }
+
dom_ui_->CallJavascriptFunction(L"getAppsCallback", dictionary);
// First time we get here we set up the observer so that we can tell update
« no previous file with comments | « no previous file | chrome/browser/extensions/default_apps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698