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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // CreateAppInfo can change the extension prefs. | 441 // CreateAppInfo can change the extension prefs. |
442 AutoReset<bool> auto_reset(&ignore_changes_, true); | 442 AutoReset<bool> auto_reset(&ignore_changes_, true); |
443 CreateAppInfo(extension, | 443 CreateAppInfo(extension, |
444 notification_manager->GetLast(extension->id()), | 444 notification_manager->GetLast(extension->id()), |
445 extension_service_, | 445 extension_service_, |
446 app_info); | 446 app_info); |
447 return app_info; | 447 return app_info; |
448 } | 448 } |
449 | 449 |
450 void AppLauncherHandler::FillPromoDictionary(DictionaryValue* dictionary) { | 450 void AppLauncherHandler::FillPromoDictionary(DictionaryValue* dictionary) { |
451 dictionary->SetString("promoHeader", AppsPromo::GetPromoHeaderText()); | 451 AppsPromo::PromoData data = AppsPromo::GetPromo(); |
452 dictionary->SetString("promoButton", AppsPromo::GetPromoButtonText()); | 452 dictionary->SetString("promoHeader", data.header); |
453 dictionary->SetString("promoLink", AppsPromo::GetPromoLink().spec()); | 453 dictionary->SetString("promoButton", data.button); |
454 dictionary->SetString("promoLogo", AppsPromo::GetPromoLogo().spec()); | 454 dictionary->SetString("promoLink", data.link.spec()); |
455 dictionary->SetString("promoExpire", AppsPromo::GetPromoExpireText()); | 455 dictionary->SetString("promoLogo", data.logo.spec()); |
| 456 dictionary->SetString("promoExpire", data.expire); |
456 } | 457 } |
457 | 458 |
458 void AppLauncherHandler::HandleGetApps(const ListValue* args) { | 459 void AppLauncherHandler::HandleGetApps(const ListValue* args) { |
459 DictionaryValue dictionary; | 460 DictionaryValue dictionary; |
460 | 461 |
461 // Tell the client whether to show the promo for this view. We don't do this | 462 // Tell the client whether to show the promo for this view. We don't do this |
462 // in the case of PREF_CHANGED because: | 463 // in the case of PREF_CHANGED because: |
463 // | 464 // |
464 // a) At that point in time, depending on the pref that changed, it can look | 465 // a) At that point in time, depending on the pref that changed, it can look |
465 // like the set of apps installed has changed, and we will mark the promo | 466 // like the set of apps installed has changed, and we will mark the promo |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 992 |
992 void AppLauncherHandler::UninstallDefaultApps() { | 993 void AppLauncherHandler::UninstallDefaultApps() { |
993 AppsPromo* apps_promo = extension_service_->apps_promo(); | 994 AppsPromo* apps_promo = extension_service_->apps_promo(); |
994 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 995 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
995 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 996 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
996 iter != app_ids.end(); ++iter) { | 997 iter != app_ids.end(); ++iter) { |
997 if (extension_service_->GetExtensionById(*iter, true)) | 998 if (extension_service_->GetExtensionById(*iter, true)) |
998 extension_service_->UninstallExtension(*iter, false, NULL); | 999 extension_service_->UninstallExtension(*iter, false, NULL); |
999 } | 1000 } |
1000 } | 1001 } |
OLD | NEW |