Chromium Code Reviews| Index: chrome/browser/ui/app_list/chrome_app_list_item.cc |
| diff --git a/chrome/browser/ui/app_list/chrome_app_list_item.cc b/chrome/browser/ui/app_list/chrome_app_list_item.cc |
| index 934638ff7118a014ef787076e99404cc43c8c956..53a3cacfbe5b38830105ef27f9086d842c50e136 100644 |
| --- a/chrome/browser/ui/app_list/chrome_app_list_item.cc |
| +++ b/chrome/browser/ui/app_list/chrome_app_list_item.cc |
| @@ -62,10 +62,18 @@ void ChromeAppListItem::UpdateFromSync( |
| void ChromeAppListItem::SetDefaultPositionIfApplicable() { |
| syncer::StringOrdinal page_ordinal; |
| syncer::StringOrdinal launch_ordinal; |
| - if (GetAppSorting()->GetDefaultOrdinals(id(), &page_ordinal, |
| - &launch_ordinal) && |
| - page_ordinal.IsValid() && launch_ordinal.IsValid()) { |
| - set_position(syncer::StringOrdinal(page_ordinal.ToInternalValue() + |
| - launch_ordinal.ToInternalValue())); |
| + extensions::AppSorting* app_sorting = GetAppSorting(); |
|
khmel
2017/01/04 20:22:52
This does not guaranty generating position for all
stevenjb
2017/01/04 20:34:26
Aha. Good catch.
khmel
2017/01/04 21:15:12
:( Kind of late. Also removed double set_position
|
| + if (!app_sorting->GetDefaultOrdinals(id(), &page_ordinal, |
| + &launch_ordinal) || |
| + !page_ordinal.IsValid() || !launch_ordinal.IsValid()) { |
| + app_sorting->EnsureValidOrdinals(id(), syncer::StringOrdinal()); |
| + page_ordinal = app_sorting->GetPageOrdinal(id()); |
| + launch_ordinal = app_sorting->GetAppLaunchOrdinal(id()); |
| + set_position(syncer::StringOrdinal( |
| + page_ordinal.ToInternalValue() + launch_ordinal.ToInternalValue())); |
| } |
| + DCHECK(page_ordinal.IsValid()); |
| + DCHECK(launch_ordinal.IsValid()); |
| + set_position(syncer::StringOrdinal(page_ordinal.ToInternalValue() + |
| + launch_ordinal.ToInternalValue())); |
| } |