Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 default: 320 default:
321 NOTREACHED(); 321 NOTREACHED();
322 } 322 }
323 } 323 }
324 324
325 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { 325 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
326 // CreateAppInfo and ClearPageIndex can change the extension prefs. 326 // CreateAppInfo and ClearPageIndex can change the extension prefs.
327 AutoReset<bool> auto_reset(&ignore_changes_, true); 327 AutoReset<bool> auto_reset(&ignore_changes_, true);
328 328
329 ListValue* list = new ListValue(); 329 ListValue* list = new ListValue();
330 const ExtensionList* extensions = extension_service_->extensions(); 330 const ExtensionSet* extensions = extension_service_->extensions();
331 ExtensionList::const_iterator it; 331 ExtensionSet::const_iterator it;
332 for (it = extensions->begin(); it != extensions->end(); ++it) { 332 for (it = extensions->begin(); it != extensions->end(); ++it) {
333 if (!IsAppExcludedFromList(*it)) { 333 const Extension* extension = *it;
334 DictionaryValue* app_info = GetAppInfo(*it); 334 if (!IsAppExcludedFromList(extension)) {
335 DictionaryValue* app_info = GetAppInfo(extension);
335 list->Append(app_info); 336 list->Append(app_info);
336 } else { 337 } else {
337 // This is necessary because in some previous versions of chrome, we set a 338 // 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, 339 // 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 340 // and this fixes it. If we don't fix it, GetNaturalAppPageIndex() doesn't
340 // work. See http://crbug.com/98325 341 // work. See http://crbug.com/98325
341 ExtensionPrefs* prefs = extension_service_->extension_prefs(); 342 ExtensionPrefs* prefs = extension_service_->extension_prefs();
342 if (prefs->GetPageIndex((*it)->id()) != -1) 343 if (prefs->GetPageIndex(extension->id()) != -1)
343 prefs->ClearPageIndex((*it)->id()); 344 prefs->ClearPageIndex(extension->id());
344 } 345 }
345 } 346 }
346 347
347 extensions = extension_service_->disabled_extensions(); 348 extensions = extension_service_->disabled_extensions();
348 for (it = extensions->begin(); it != extensions->end(); ++it) { 349 for (it = extensions->begin(); it != extensions->end(); ++it) {
349 if (!IsAppExcludedFromList(*it)) { 350 if (!IsAppExcludedFromList(*it)) {
350 DictionaryValue* app_info = new DictionaryValue(); 351 DictionaryValue* app_info = new DictionaryValue();
351 CreateAppInfo(*it, 352 CreateAppInfo(*it,
352 NULL, 353 NULL,
353 extension_service_, 354 extension_service_,
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 954
954 void AppLauncherHandler::UninstallDefaultApps() { 955 void AppLauncherHandler::UninstallDefaultApps() {
955 AppsPromo* apps_promo = extension_service_->apps_promo(); 956 AppsPromo* apps_promo = extension_service_->apps_promo();
956 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 957 const ExtensionIdSet& app_ids = apps_promo->old_default_apps();
957 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 958 for (ExtensionIdSet::const_iterator iter = app_ids.begin();
958 iter != app_ids.end(); ++iter) { 959 iter != app_ids.end(); ++iter) {
959 if (extension_service_->GetExtensionById(*iter, true)) 960 if (extension_service_->GetExtensionById(*iter, true))
960 extension_service_->UninstallExtension(*iter, false, NULL); 961 extension_service_->UninstallExtension(*iter, false, NULL);
961 } 962 }
962 } 963 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698