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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 7706029: ntp4: make sure webstore app is first by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix infinite recursion Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 53c68cf8f26dfb7e8275ee04e5dd6694acd457dc..d42eb2164cd373c3e67e2887007f80de8a041c3f 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -156,7 +156,11 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
int app_launch_index = prefs->GetAppLaunchIndex(extension->id());
if (app_launch_index == -1) {
// Make sure every app has a launch index (some predate the launch index).
- app_launch_index = prefs->GetNextAppLaunchIndex(0);
+ // The webstore's app launch index is set to -2 to make sure it's first.
+ // The next time the user drags (any) app this will be set to something
+ // sane (i.e. >= 0).
+ app_launch_index = extension->id() == extension_misc::kWebStoreAppId ?
+ -2 : prefs->GetNextAppLaunchIndex(0);
prefs->SetAppLaunchIndex(extension->id(), app_launch_index);
}
value->SetInteger("app_launch_index", app_launch_index);
@@ -322,6 +326,9 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
}
}
+ // CreateAppInfo can change the extension prefs.
+ AutoReset<bool> auto_reset(&ignore_changes_, true);
+
extensions = extension_service_->disabled_extensions();
for (it = extensions->begin(); it != extensions->end(); ++it) {
if (!IsAppExcludedFromList(*it)) {
@@ -381,6 +388,8 @@ DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) {
AppNotificationManager* notification_manager =
extension_service_->app_notification_manager();
DictionaryValue* app_info = new DictionaryValue();
+ // CreateAppInfo can change the extension prefs.
+ AutoReset<bool> auto_reset(&ignore_changes_, true);
CreateAppInfo(extension,
notification_manager->GetLast(extension->id()),
extension_service_,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698