Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_BUILDER_H_ | |
| 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_BUILDER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | |
| 12 #include "ui/app_list/app_list_item_list_observer.h" | |
| 13 #include "ui/app_list/app_list_model.h" | |
| 14 | |
| 15 class AppListControllerDelegate; | |
| 16 class Profile; | |
| 17 | |
| 18 // This abstract class populates and maintains the given |model| with | |
| 19 // information from |profile| for the specific item type. | |
| 20 class AppListModelBuilder : public app_list::AppListItemListObserver { | |
| 21 public: | |
| 22 explicit AppListModelBuilder(AppListControllerDelegate* controller, | |
|
jochen (gone - plz use gerrit)
2015/12/03 10:25:39
no explicit, can you clarify whether it takes owne
khmel1
2015/12/03 12:34:49
Removed explicit (left from legacy code with one p
| |
| 23 const char* item_type); | |
| 24 ~AppListModelBuilder() override; | |
| 25 | |
| 26 // Initialize to use app-list sync and sets |service_| to |service|. | |
|
jochen (gone - plz use gerrit)
2015/12/03 10:25:39
this comment should tell whether it takes ownershi
khmel1
2015/12/03 12:34:49
Done.
| |
| 27 void InitializeWithService(app_list::AppListSyncableService* service, | |
| 28 app_list::AppListModel* model); | |
| 29 | |
| 30 // Initialize to use extension sync and sets |service_| to NULL. Used in | |
|
jochen (gone - plz use gerrit)
2015/12/03 10:25:39
nullptr
khmel1
2015/12/03 12:34:49
Done.
| |
| 31 // tests and when AppList sync is not enabled. | |
| 32 void InitializeWithProfile(Profile* profile, app_list::AppListModel* model); | |
| 33 | |
| 34 protected: | |
| 35 // Builds the model with the current profile. | |
| 36 virtual void BuildModel() = 0; | |
| 37 | |
| 38 app_list::AppListSyncableService* service() { return service_; } | |
| 39 | |
| 40 Profile* profile() { return profile_; } | |
| 41 | |
| 42 AppListControllerDelegate* controller() { return controller_; } | |
| 43 | |
| 44 app_list::AppListModel* model() { return model_; } | |
| 45 | |
| 46 // Inserts an app based on app ordinal prefs. | |
| 47 void InsertApp(scoped_ptr<app_list::AppListItem> app); | |
| 48 | |
| 49 const app_list::AppListSyncableService::SyncItem* GetSyncItem( | |
| 50 const std::string& id); | |
| 51 | |
| 52 // Returns app instance matching |id| or NULL. | |
| 53 app_list::AppListItem* GetAppItem(const std::string& id); | |
| 54 | |
| 55 private: | |
| 56 // Unowned pointers to the service that owns this and associated profile. | |
| 57 app_list::AppListSyncableService* service_ = nullptr; | |
| 58 Profile* profile_ = nullptr; | |
| 59 | |
| 60 // Unowned pointer to the app list controller. | |
| 61 AppListControllerDelegate* controller_; | |
| 62 | |
| 63 // Unowned pointer to the app list model. | |
| 64 app_list::AppListModel* model_ = nullptr; | |
| 65 | |
| 66 // Global constant defined for each item type. | |
| 67 const char* item_type_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(AppListModelBuilder); | |
| 70 }; | |
| 71 | |
| 72 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_BUILDER_H_ | |
| OLD | NEW |