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