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

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

Issue 7354023: Fix for memory leak bug 89144. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months 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
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { 283 void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
284 ListValue* list = new ListValue(); 284 ListValue* list = new ListValue();
285 const ExtensionList* extensions = extensions_service_->extensions(); 285 const ExtensionList* extensions = extensions_service_->extensions();
286 ExtensionList::const_iterator it; 286 ExtensionList::const_iterator it;
287 for (it = extensions->begin(); it != extensions->end(); ++it) { 287 for (it = extensions->begin(); it != extensions->end(); ++it) {
288 // Don't include the WebStore and the Cloud Print app. 288 // Don't include the WebStore and the Cloud Print app.
289 // The WebStore launcher gets special treatment in ntp/apps.js. 289 // The WebStore launcher gets special treatment in ntp/apps.js.
290 // The Cloud Print app should never be displayed in the NTP. 290 // The Cloud Print app should never be displayed in the NTP.
291 const Extension* extension = *it; 291 const Extension* extension = *it;
292 DictionaryValue* app_info = GetAppInfo(extension); 292 DictionaryValue* app_info = GetAppInfo(extension);
293 if (app_info && ((*it)->id() != extension_misc::kCloudPrintAppId)) 293 if (app_info)
294 list->Append(app_info); 294 list->Append(app_info);
295 } 295 }
296 296
297 extensions = extensions_service_->disabled_extensions(); 297 extensions = extensions_service_->disabled_extensions();
298 for (it = extensions->begin(); it != extensions->end(); ++it) { 298 for (it = extensions->begin(); it != extensions->end(); ++it) {
299 bool ntp3 = 299 bool ntp3 =
300 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4); 300 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4);
301 if ((*it)->is_app() && 301 if ((*it)->is_app() &&
302 !(ntp3 && (*it)->id() == extension_misc::kWebStoreAppId) && 302 !(ntp3 && (*it)->id() == extension_misc::kWebStoreAppId) &&
303 ((*it)->id() != extension_misc::kCloudPrintAppId)) { 303 ((*it)->id() != extension_misc::kCloudPrintAppId)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 dictionary->Set("appPageNames", 338 dictionary->Set("appPageNames",
339 static_cast<ListValue*>(app_page_names->DeepCopy())); 339 static_cast<ListValue*>(app_page_names->DeepCopy()));
340 } 340 }
341 } 341 }
342 } 342 }
343 343
344 DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) { 344 DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) {
345 bool ntp3 = 345 bool ntp3 =
346 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4); 346 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4);
347 if (!extension->is_app() || 347 if (!extension->is_app() ||
348 (ntp3 && extension->id() == extension_misc::kWebStoreAppId)) { 348 (ntp3 && extension->id() == extension_misc::kWebStoreAppId) ||
349 (extension->id() == extension_misc::kCloudPrintAppId)) {
349 return NULL; 350 return NULL;
350 } 351 }
351 352
352 DictionaryValue* app_info = new DictionaryValue(); 353 DictionaryValue* app_info = new DictionaryValue();
353 AppNotificationManager* notification_manager = 354 AppNotificationManager* notification_manager =
354 extensions_service_->app_notification_manager(); 355 extensions_service_->app_notification_manager();
355 CreateAppInfo(extension, 356 CreateAppInfo(extension,
356 notification_manager->GetLast(extension->id()), 357 notification_manager->GetLast(extension->id()),
357 extensions_service_, 358 extensions_service_,
358 app_info); 359 app_info);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 785
785 void AppLauncherHandler::UninstallDefaultApps() { 786 void AppLauncherHandler::UninstallDefaultApps() {
786 AppsPromo* apps_promo = extensions_service_->apps_promo(); 787 AppsPromo* apps_promo = extensions_service_->apps_promo();
787 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 788 const ExtensionIdSet& app_ids = apps_promo->old_default_apps();
788 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 789 for (ExtensionIdSet::const_iterator iter = app_ids.begin();
789 iter != app_ids.end(); ++iter) { 790 iter != app_ids.end(); ++iter) {
790 if (extensions_service_->GetExtensionById(*iter, true)) 791 if (extensions_service_->GetExtensionById(*iter, true))
791 extensions_service_->UninstallExtension(*iter, false, NULL); 792 extensions_service_->UninstallExtension(*iter, false, NULL);
792 } 793 }
793 } 794 }
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698