1 // Copyright 2018 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.
4 
5 #include "chrome/browser/ui/app_list/page_break_app_item.h"
6 
7 // static
8 const char PageBreakAppItem::kItemType[] = "DefaultPageBreak";
9 
PageBreakAppItem(Profile * profile,AppListModelUpdater * model_updater,const app_list::AppListSyncableService::SyncItem * sync_item,const std::string & app_id)10 PageBreakAppItem::PageBreakAppItem(
11     Profile* profile,
12     AppListModelUpdater* model_updater,
13     const app_list::AppListSyncableService::SyncItem* sync_item,
14     const std::string& app_id)
15     : ChromeAppListItem(profile, app_id) {
16   SetIsPageBreak(true);
17 
18   if (sync_item) {
19     DCHECK_EQ(sync_item->item_type, sync_pb::AppListSpecifics::TYPE_PAGE_BREAK);
20     if (sync_item->item_ordinal.IsValid()) {
21       UpdateFromSync(sync_item);
22       return;
23     }
24   }
25 
26   SetDefaultPositionIfApplicable(model_updater);
27 
28   // Set model updater last to avoid being called during construction.
29   set_model_updater(model_updater);
30 }
31 
32 PageBreakAppItem::~PageBreakAppItem() = default;
33 
34 // ChromeAppListItem:
Activate(int event_flags)35 void PageBreakAppItem::Activate(int event_flags) {
36   NOTREACHED();
37 }
38 
GetItemType() const39 const char* PageBreakAppItem::GetItemType() const {
40   return kItemType;
41 }
42