OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 ExtensionDialogAccepted(); | 585 ExtensionDialogAccepted(); |
586 } else { | 586 } else { |
587 GetExtensionUninstallDialog()->ConfirmUninstall(this, extension); | 587 GetExtensionUninstallDialog()->ConfirmUninstall(this, extension); |
588 } | 588 } |
589 } | 589 } |
590 | 590 |
591 void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) { | 591 void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) { |
592 // If the user has intentionally hidden the promotion, we'll uninstall all the | 592 // If the user has intentionally hidden the promotion, we'll uninstall all the |
593 // default apps (we know the user hasn't installed any apps on their own at | 593 // default apps (we know the user hasn't installed any apps on their own at |
594 // this point, or the promotion wouldn't have been shown). | 594 // this point, or the promotion wouldn't have been shown). |
| 595 // TODO(estade): this isn't used right now as we sort out the future of the |
| 596 // apps promo on ntp4. |
595 if (NewTabUI::Ntp4Enabled()) { | 597 if (NewTabUI::Ntp4Enabled()) { |
596 UninstallDefaultApps(); | 598 UninstallDefaultApps(); |
597 extension_service_->apps_promo()->HidePromo(); | 599 extension_service_->apps_promo()->HidePromo(); |
598 } else { | 600 } else { |
599 // TODO(estade): remove all this. NTP3 uninstalled all the default apps then | 601 // TODO(estade): remove all this. NTP3 uninstalled all the default apps then |
600 // refreshed the entire NTP, we don't have to jump through these hoops for | 602 // refreshed the entire NTP, we don't have to jump through these hoops for |
601 // NTP4 because each app uninstall is handled separately without reloading | 603 // NTP4 because each app uninstall is handled separately without reloading |
602 // the entire page. | 604 // the entire page. |
603 ignore_changes_ = true; | 605 ignore_changes_ = true; |
604 UninstallDefaultApps(); | 606 UninstallDefaultApps(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 911 |
910 void AppLauncherHandler::UninstallDefaultApps() { | 912 void AppLauncherHandler::UninstallDefaultApps() { |
911 AppsPromo* apps_promo = extension_service_->apps_promo(); | 913 AppsPromo* apps_promo = extension_service_->apps_promo(); |
912 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 914 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
913 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 915 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
914 iter != app_ids.end(); ++iter) { | 916 iter != app_ids.end(); ++iter) { |
915 if (extension_service_->GetExtensionById(*iter, true)) | 917 if (extension_service_->GetExtensionById(*iter, true)) |
916 extension_service_->UninstallExtension(*iter, false, NULL); | 918 extension_service_->UninstallExtension(*iter, false, NULL); |
917 } | 919 } |
918 } | 920 } |
OLD | NEW |