| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/app_list/app_list_model_observer.h" | 9 #include "ui/app_list/app_list_model_observer.h" |
| 10 | 10 |
| 11 namespace app_list { | 11 namespace app_list { |
| 12 | 12 |
| 13 class AppListModel; | 13 class AppListModel; |
| 14 class AppListPrefs; | 14 class AppListPrefs; |
| 15 | 15 |
| 16 // A class which listens to an AppListModel and updates the local pref model of | 16 // A class which listens to an AppListModel and updates the local pref model of |
| 17 // the app list accordingly. | 17 // the app list accordingly. |
| 18 class ModelPrefUpdater : public AppListModelObserver { | 18 class ModelPrefUpdater : public AppListModelObserver { |
| 19 public: | 19 public: |
| 20 ModelPrefUpdater(AppListPrefs* app_list_prefs, AppListModel* model); | 20 ModelPrefUpdater(AppListPrefs* app_list_prefs, AppListModel* model); |
| 21 virtual ~ModelPrefUpdater(); | 21 virtual ~ModelPrefUpdater(); |
| 22 | 22 |
| 23 // Overridden from AppListModelObserver: | 23 // Overridden from AppListModelObserver: |
| 24 virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE; | 24 virtual void OnAppListItemAdded(AppListItem* item) override; |
| 25 virtual void OnAppListItemWillBeDeleted(AppListItem* item) OVERRIDE; | 25 virtual void OnAppListItemWillBeDeleted(AppListItem* item) override; |
| 26 virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE; | 26 virtual void OnAppListItemUpdated(AppListItem* item) override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 void UpdatePrefsFromAppListItem(AppListItem* item); | 29 void UpdatePrefsFromAppListItem(AppListItem* item); |
| 30 | 30 |
| 31 AppListPrefs* app_list_prefs_; | 31 AppListPrefs* app_list_prefs_; |
| 32 AppListModel* model_; | 32 AppListModel* model_; |
| 33 | 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(ModelPrefUpdater); | 34 DISALLOW_COPY_AND_ASSIGN(ModelPrefUpdater); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 } // namespace app_list | 37 } // namespace app_list |
| 38 | 38 |
| 39 #endif // CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ | 39 #endif // CHROME_BROWSER_UI_APP_LIST_MODEL_PREF_UPDATER_H_ |
| OLD | NEW |