OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_APPS_MODEL_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 11 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "ui/app_list/app_list_model.h" | 14 #include "ui/app_list/app_list_model.h" |
15 | 15 |
16 class AppListController; | 16 class AppListControllerDelegate; |
17 class ExtensionAppItem; | 17 class ExtensionAppItem; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 class AppsModelBuilder : public content::NotificationObserver { | 20 class AppsModelBuilder : public content::NotificationObserver { |
21 public: | 21 public: |
22 AppsModelBuilder(Profile* profile, | 22 AppsModelBuilder(Profile* profile, |
23 app_list::AppListModel::Apps* model, | 23 app_list::AppListModel::Apps* model, |
24 AppListController* controller); | 24 AppListControllerDelegate* controller); |
25 virtual ~AppsModelBuilder(); | 25 virtual ~AppsModelBuilder(); |
26 | 26 |
27 // Populates the model. | 27 // Populates the model. |
28 void Build(); | 28 void Build(); |
29 | 29 |
30 private: | 30 private: |
31 // Populates the model with apps. | 31 // Populates the model with apps. |
32 void PopulateApps(); | 32 void PopulateApps(); |
33 | 33 |
34 // Re-sort apps in case app ordinal prefs are changed. | 34 // Re-sort apps in case app ordinal prefs are changed. |
(...skipping 13 matching lines...) Expand all Loading... |
48 | 48 |
49 // Returns app instance at given |index|. | 49 // Returns app instance at given |index|. |
50 ExtensionAppItem* GetAppAt(size_t index); | 50 ExtensionAppItem* GetAppAt(size_t index); |
51 | 51 |
52 // content::NotificationObserver | 52 // content::NotificationObserver |
53 virtual void Observe(int type, | 53 virtual void Observe(int type, |
54 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) OVERRIDE; | 55 const content::NotificationDetails& details) OVERRIDE; |
56 | 56 |
57 Profile* profile_; | 57 Profile* profile_; |
58 AppListController* controller_; | 58 AppListControllerDelegate* controller_; |
59 | 59 |
60 // Sub apps model of AppListModel that represents apps grid view. | 60 // Sub apps model of AppListModel that represents apps grid view. |
61 app_list::AppListModel::Apps* model_; | 61 app_list::AppListModel::Apps* model_; |
62 | 62 |
63 std::string highlight_app_id_; | 63 std::string highlight_app_id_; |
64 | 64 |
65 content::NotificationRegistrar registrar_; | 65 content::NotificationRegistrar registrar_; |
66 PrefChangeRegistrar pref_change_registrar_; | 66 PrefChangeRegistrar pref_change_registrar_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder); | 68 DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder); |
69 }; | 69 }; |
70 | 70 |
71 #endif // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ | 71 #endif // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ |
OLD | NEW |