1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_FAST_SHOW_PICKLER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_FAST_SHOW_PICKLER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/pickle.h"
12 #include "ui/app_list/app_list_model.h"
14 // Functions for pickling/unpickling AppListModel for fast show. Fast show is
15 // where the app list is put on the screen using data retrieved from a cache
16 // before the extension system has loaded.
17 class FastShowPickler
{
19 // The version that this pickler understands.
20 static const int kVersion
;
22 // Pickles a subset of the data in |model| that is useful for doing a fast
23 // show of the app list.
24 static scoped_ptr
<base::Pickle
> PickleAppListModelForFastShow(
25 app_list::AppListModel
* model
);
27 // Given a Pickle created by PickleAppListModelForFastShow(), this creates an
28 // AppListModel that represents it.
29 static scoped_ptr
<app_list::AppListModel
> UnpickleAppListModelForFastShow(
30 base::Pickle
* pickle
);
32 // Copies parts that are needed to show the app list quickly on startup from
35 app_list::AppListModel
* src
, app_list::AppListModel
* dest
);
38 // Private static methods allow friend access to AppListItem methods.
39 static scoped_ptr
<app_list::AppListItem
> UnpickleAppListItem(
40 base::PickleIterator
* it
);
41 static bool PickleAppListItem(base::Pickle
* pickle
,
42 app_list::AppListItem
* item
);
43 static void CopyOverItem(app_list::AppListItem
* src_item
,
44 app_list::AppListItem
* dest_item
);
47 #endif // CHROME_BROWSER_UI_APP_LIST_FAST_SHOW_PICKLER_H_