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

Issue 27438002: Store AppItems as pages in AppListModel. (Closed)

Created:
7 years, 2 months ago by stevenjb
Modified:
6 years, 11 months ago
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org, tfarina, extensions-reviews_chromium.org, chromium-apps-reviews_chromium.org
Visibility:
Public.

Description

Store AppItems as pages in AppListModel. * Adds a StringOrdinal to AppListItemModel to track item order * Makes app_items_ private and adds model accessors to add/delete/move * Adds observers to AppListModelObserver in lieu of ListModelObservers * Makes app_items_ a vector, one entry per page of items BUG=305024

Patch Set 1 #

Patch Set 2 : Fix unit_tests #

Patch Set 3 : Fix ash_shell #

Patch Set 4 : Mac fixes #

Patch Set 5 : More fixes #

Patch Set 6 : Fix AppListTestModel #

Patch Set 7 : Add app_list_model_unittest #

Patch Set 8 : Clang fix #

Patch Set 9 : Mac tests fix #

Patch Set 10 : Mac tests fix #

Patch Set 11 : Mac tests fix #

Patch Set 12 : Mac tests fix #

Patch Set 13 : Mac tests fix #

Patch Set 14 : Fix FastShowPickler #

Patch Set 15 : . #

Total comments: 16

Patch Set 16 : Address comments #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+775 lines, -215 lines) Patch
M ash/shell/app_list.cc View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/app_list/extension_app_model_builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +8 lines, -5 lines 0 comments Download
M chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +10 lines, -7 lines 0 comments Download
M chrome/browser/ui/app_list/fast_show_pickler.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/browser/ui/app_list/fast_show_pickler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +43 lines, -19 lines 0 comments Download
M chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +27 lines, -23 lines 0 comments Download
M ui/app_list/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M ui/app_list/app_list.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +11 lines, -0 lines 0 comments Download
M ui/app_list/app_list_item_model.h View 3 chunks +6 lines, -0 lines 2 comments Download
M ui/app_list/app_list_model.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +59 lines, -11 lines 2 comments Download
M ui/app_list/app_list_model.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +223 lines, -17 lines 2 comments Download
M ui/app_list/app_list_model_observer.h View 1 chunk +8 lines, -0 lines 2 comments Download
M ui/app_list/cocoa/apps_grid_controller.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +32 lines, -19 lines 0 comments Download
M ui/app_list/cocoa/apps_grid_controller_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +21 lines, -25 lines 0 comments Download
A ui/app_list/test/app_list_model_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +208 lines, -0 lines 0 comments Download
M ui/app_list/test/app_list_test_model.h View 1 2 3 4 5 6 2 chunks +8 lines, -5 lines 0 comments Download
M ui/app_list/test/app_list_test_model.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +22 lines, -12 lines 0 comments Download
M ui/app_list/views/app_list_main_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +12 lines, -10 lines 0 comments Download
M ui/app_list/views/apps_grid_view.h View 1 2 3 4 5 6 7 4 chunks +7 lines, -8 lines 0 comments Download
M ui/app_list/views/apps_grid_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10 chunks +40 lines, -31 lines 6 comments Download
M ui/app_list/views/apps_grid_view_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 13 chunks +21 lines, -16 lines 0 comments Download
M ui/views/test/views_test_base.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
stevenjb
This still needs some more unit tests, but I wanted to get an early review ...
7 years, 2 months ago (2013-10-18 01:04:07 UTC) #1
benwells
On 2013/10/18 01:04:07, stevenjb wrote: > This still needs some more unit tests, but I ...
7 years, 2 months ago (2013-10-18 04:19:47 UTC) #2
koz (OOO until 15th September)
It's a bit hard to see the forest for the trees here. What does having ...
7 years, 2 months ago (2013-10-18 05:17:17 UTC) #3
xiyuan
I have a proposal: - Keep the items still as a ListModel in AppListModel - ...
7 years, 2 months ago (2013-10-18 17:29:35 UTC) #4
stevenjb
The intention behind putting the concept of pages into the model is to keep that ...
7 years, 2 months ago (2013-10-18 19:30:55 UTC) #5
stevenjb
On Thu, Oct 17, 2013 at 9:19 PM, <benwells@chromium.org> wrote: > On 2013/10/18 01:04:07, stevenjb ...
7 years, 2 months ago (2013-10-18 19:39:23 UTC) #6
tfarina
On Thu, Oct 17, 2013 at 10:04 PM, <stevenjb@chromium.org> wrote: > Reviewers: jennyz, xiyuan, benwells, ...
7 years, 2 months ago (2013-10-18 19:58:29 UTC) #7
stevenjb
https://codereview.chromium.org/27438002/diff/114001/chrome/browser/ui/app_list/extension_app_model_builder.cc File chrome/browser/ui/app_list/extension_app_model_builder.cc (right): https://codereview.chromium.org/27438002/diff/114001/chrome/browser/ui/app_list/extension_app_model_builder.cc#newcode168 chrome/browser/ui/app_list/extension_app_model_builder.cc:168: model_->DeleteItemAt(0, i); On 2013/10/18 05:17:17, koz wrote: > Should ...
7 years, 2 months ago (2013-10-18 22:14:26 UTC) #8
xiyuan
https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_item_model.h File ui/app_list/app_list_item_model.h (right): https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_item_model.h#newcode52 ui/app_list/app_list_item_model.h:52: position_ = new_position; Should we add an observer method ...
7 years, 2 months ago (2013-10-18 23:04:07 UTC) #9
stevenjb
7 years, 2 months ago (2013-10-19 01:04:42 UTC) #10
Thanks for all the feedback!

I plan to think about this some more over the weekend and write up a doc.
Hopefully the doc will explain why I think the model changes are necessary for
syncing app lists across platforms.

My current thinking is that with some small changes to the existing Views and
Cocoa code, we can make this model stable with or without gaps at the ends of
pages, then tackle sync leisurely (https://codereview.chromium.org/29613004/
should address the short term sync issues).

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_ite...
File ui/app_list/app_list_item_model.h (right):

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_ite...
ui/app_list/app_list_item_model.h:52: position_ = new_position;
On 2013/10/18 23:04:08, xiyuan wrote:
> Should we add an observer method for this as well? It would be useful when the
> position is from sync instead of MoveItem.
> 
> On the sync topic, we might want to keep track of the page ordinal here too.
And
> having a method in AppListModel to rebuild the paging structure from it.

Yes, when we sync this will need to be more than a trivial setter. Not sure we
need an observer, but thus will definitely change to SetPosition() and will take
a page index as well as an item ordinal.

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
File ui/app_list/app_list_model.cc (right):

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
ui/app_list/app_list_model.cc:162: for (; item_idx < apps->item_count();
++item_idx) {
On 2013/10/18 23:04:08, xiyuan wrote:
> Can we make this loop of insertion an item part of ItemPage? That is, add an
> AddItem method to ItemPage which insert an item in the page based on
> item->GetSortOrder().

That sounds reasonable. I kind of wanted to keep the logic together for now, but
can see moving it.

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
File ui/app_list/app_list_model.h (right):

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
ui/app_list/app_list_model.h:72: AppListItemModel* GetItemAt(size_t page_idx,
size_t item_idx);
On 2013/10/18 23:04:08, xiyuan wrote:
> Propose to use page id instead of index. It would be easier to use page id to
> track the page than index. Maybe put a TODO if we don't get to it in this CL.

I'll think about that. I can see where it makes sense, but it might also make
the View implementation more difficult. Maybe we'll want both?

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
File ui/app_list/app_list_model_observer.h (right):

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/app_list_mod...
ui/app_list/app_list_model_observer.h:24: virtual void OnListItemsAdded(size_t
page_index,
On 2013/10/18 23:04:08, xiyuan wrote:
> nit: Rename to OnPageItemsAdded? OnListItemxxxx is bit confusing.

Sounds reasonable.

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/views/apps_g...
File ui/app_list/views/apps_grid_view.cc (right):

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/views/apps_g...
ui/app_list/views/apps_grid_view.cc:1183: size_t offset = page_index *
AppListModel::GetNumAppsPerPage();
On 2013/10/18 23:04:08, xiyuan wrote:
> int offset = GetModelIndexFromIndex(Index(page_index, 0));
> 
> GetModelIndexFromIndex does a similar thing but with consideration of a start
> page.
> 
> --show-app-list-start-page would trigger the start page.

Ah, thanks. Will do.

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/views/apps_g...
ui/app_list/views/apps_grid_view.cc:1200: size_t index = page_index *
AppListModel::GetNumAppsPerPage() + start;
On 2013/10/18 23:04:08, xiyuan wrote:
> GetModelIndexFromIndex(Index(page_index, start));

Ditto

https://codereview.chromium.org/27438002/diff/345001/ui/app_list/views/apps_g...
ui/app_list/views/apps_grid_view.cc:1216: size_t offset = page_index *
AppListModel::GetNumAppsPerPage();
On 2013/10/18 23:04:08, xiyuan wrote:
> use GetModelIndexFromIndex

Ditto

Powered by Google App Engine
This is Rietveld 408576698