OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_APP_LIST_SYNCABLE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
10 | 12 |
11 class ExtensionAppModelBuilder; | 13 class ExtensionAppModelBuilder; |
| 14 class ExtensionService; |
12 class Profile; | 15 class Profile; |
13 | 16 |
14 namespace app_list { | 17 namespace app_list { |
15 | 18 |
16 class AppListModel; | 19 class AppListModel; |
17 | 20 |
18 // Keyed Service that owns, stores, and syncs an AppListModel for a profile. | 21 // Keyed Service that owns, stores, and syncs an AppListModel for an |
| 22 // ExtensionSystem and corresponding profile. |
19 // TODO(stevenjb): Integrate with Sync. crbug.com/305024. | 23 // TODO(stevenjb): Integrate with Sync. crbug.com/305024. |
20 class AppListSyncableService : public BrowserContextKeyedService { | 24 class AppListSyncableService : public BrowserContextKeyedService, |
| 25 public content::NotificationObserver { |
21 public: | 26 public: |
22 explicit AppListSyncableService(Profile* profile); | 27 // Create an empty model. Then, if |extension_service| is non-NULL and ready, |
| 28 // populate it. Otherwise populate the model once extensions become ready. |
| 29 AppListSyncableService(Profile* profile, ExtensionService* extension_service); |
| 30 |
23 virtual ~AppListSyncableService(); | 31 virtual ~AppListSyncableService(); |
24 | 32 |
25 AppListModel* model() { return model_.get(); } | 33 AppListModel* model() { return model_.get(); } |
26 | 34 |
27 private: | 35 private: |
| 36 void BuildModel(); |
| 37 |
| 38 // content::NotificationObserver: |
| 39 virtual void Observe(int type, |
| 40 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) OVERRIDE; |
| 42 |
28 Profile* profile_; | 43 Profile* profile_; |
| 44 content::NotificationRegistrar registrar_; |
29 scoped_ptr<AppListModel> model_; | 45 scoped_ptr<AppListModel> model_; |
30 scoped_ptr<ExtensionAppModelBuilder> apps_builder_; | 46 scoped_ptr<ExtensionAppModelBuilder> apps_builder_; |
31 | 47 |
32 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); | 48 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); |
33 }; | 49 }; |
34 | 50 |
35 } // namespace app_list | 51 } // namespace app_list |
36 | 52 |
37 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 53 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
OLD | NEW |