Commit 16e07c0c authored by estade@chromium.org's avatar estade@chromium.org

ntp4: hook up 'no thanks' app promo link.

BUG=none
TEST=manual

Review URL: http://codereview.chromium.org/7572029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95504 0039d316-1c4b-4281-b951-d872f2087c98
parent c83ac3eb
......@@ -231,11 +231,23 @@ cr.define('ntp4', function() {
this.appsPromoHide_ =
this.appsPromoExtras_.querySelector('.apps-promo-hide');
this.appsPromoHide_.addEventListener('click',
this.onHidePromoClicked_.bind(this));
this.appendChild(this.appsPromoExtras_);
this.appsPromoExtras_.hidden = false;
// TODO(estade): A ping url needs to be set for the app icon.
},
/**
* Handles when the "No, thanks" promo link is clicked.
* @private
*/
onHidePromoClicked_: function(e) {
chrome.send('hideAppsPromo');
this.setAppsPromoData(null);
},
/**
* Sets the apps promo appearance. If |data| is null, there is no promo. If
* |data| is non-null, it contains strings to be shown for the promo. The
......
......@@ -591,11 +591,20 @@ void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) {
// If the user has intentionally hidden the promotion, we'll uninstall all the
// default apps (we know the user hasn't installed any apps on their own at
// this point, or the promotion wouldn't have been shown).
ignore_changes_ = true;
UninstallDefaultApps();
extension_service_->apps_promo()->HidePromo();
ignore_changes_ = false;
HandleGetApps(NULL);
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) {
UninstallDefaultApps();
extension_service_->apps_promo()->HidePromo();
} else {
// TODO(estade): remove all this. NTP3 uninstalled all the default apps then
// refreshed the entire NTP, we don't have to jump through these hoops for
// NTP4 because each app uninstall is handled separately without reloading
// the entire page.
ignore_changes_ = true;
UninstallDefaultApps();
extension_service_->apps_promo()->HidePromo();
ignore_changes_ = false;
HandleGetApps(NULL);
}
}
void AppLauncherHandler::HandleCreateAppShortcut(const ListValue* args) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment