| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 default: | 319 default: |
| 320 NOTREACHED(); | 320 NOTREACHED(); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { | 324 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { |
| 325 // CreateAppInfo and ClearPageIndex can change the extension prefs. | 325 // CreateAppInfo and ClearPageIndex can change the extension prefs. |
| 326 AutoReset<bool> auto_reset(&ignore_changes_, true); | 326 AutoReset<bool> auto_reset(&ignore_changes_, true); |
| 327 | 327 |
| 328 ListValue* list = new ListValue(); | 328 ListValue* list = new ListValue(); |
| 329 const ExtensionSet* extensions = extension_service_->extensions(); | 329 const ExtensionList* extensions = extension_service_->extensions(); |
| 330 ExtensionSet::const_iterator it; | 330 ExtensionList::const_iterator it; |
| 331 for (it = extensions->begin(); it != extensions->end(); ++it) { | 331 for (it = extensions->begin(); it != extensions->end(); ++it) { |
| 332 const Extension* extension = *it; | 332 if (!IsAppExcludedFromList(*it)) { |
| 333 if (!IsAppExcludedFromList(extension)) { | 333 DictionaryValue* app_info = GetAppInfo(*it); |
| 334 DictionaryValue* app_info = GetAppInfo(extension); | |
| 335 list->Append(app_info); | 334 list->Append(app_info); |
| 336 } else { | 335 } else { |
| 337 // This is necessary because in some previous versions of chrome, we set a | 336 // This is necessary because in some previous versions of chrome, we set a |
| 338 // page index for non-app extensions. Old profiles can persist this error, | 337 // page index for non-app extensions. Old profiles can persist this error, |
| 339 // and this fixes it. If we don't fix it, GetNaturalAppPageIndex() doesn't | 338 // and this fixes it. If we don't fix it, GetNaturalAppPageIndex() doesn't |
| 340 // work. See http://crbug.com/98325 | 339 // work. See http://crbug.com/98325 |
| 341 ExtensionPrefs* prefs = extension_service_->extension_prefs(); | 340 ExtensionPrefs* prefs = extension_service_->extension_prefs(); |
| 342 if (prefs->GetPageIndex(extension->id()) != -1) | 341 if (prefs->GetPageIndex((*it)->id()) != -1) |
| 343 prefs->ClearPageIndex(extension->id()); | 342 prefs->ClearPageIndex((*it)->id()); |
| 344 } | 343 } |
| 345 } | 344 } |
| 346 | 345 |
| 347 extensions = extension_service_->disabled_extensions(); | 346 extensions = extension_service_->disabled_extensions(); |
| 348 for (it = extensions->begin(); it != extensions->end(); ++it) { | 347 for (it = extensions->begin(); it != extensions->end(); ++it) { |
| 349 if (!IsAppExcludedFromList(*it)) { | 348 if (!IsAppExcludedFromList(*it)) { |
| 350 DictionaryValue* app_info = new DictionaryValue(); | 349 DictionaryValue* app_info = new DictionaryValue(); |
| 351 CreateAppInfo(*it, | 350 CreateAppInfo(*it, |
| 352 NULL, | 351 NULL, |
| 353 extension_service_, | 352 extension_service_, |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 | 934 |
| 936 void AppLauncherHandler::UninstallDefaultApps() { | 935 void AppLauncherHandler::UninstallDefaultApps() { |
| 937 AppsPromo* apps_promo = extension_service_->apps_promo(); | 936 AppsPromo* apps_promo = extension_service_->apps_promo(); |
| 938 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 937 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 939 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); | 938 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 940 iter != app_ids.end(); ++iter) { | 939 iter != app_ids.end(); ++iter) { |
| 941 if (extension_service_->GetExtensionById(*iter, true)) | 940 if (extension_service_->GetExtensionById(*iter, true)) |
| 942 extension_service_->UninstallExtension(*iter, false, NULL); | 941 extension_service_->UninstallExtension(*iter, false, NULL); |
| 943 } | 942 } |
| 944 } | 943 } |
| OLD | NEW |