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; |
12 class Profile; | 14 class Profile; |
13 | 15 |
| 16 namespace extensions { |
| 17 class ExtensionSystem; |
| 18 } |
| 19 |
14 namespace app_list { | 20 namespace app_list { |
15 | 21 |
16 class AppListModel; | 22 class AppListModel; |
17 | 23 |
18 // Keyed Service that owns, stores, and syncs an AppListModel for a profile. | 24 // Keyed Service that owns, stores, and syncs an AppListModel for an |
| 25 // ExtensionSystem and corresponding profile. |
19 // TODO(stevenjb): Integrate with Sync. crbug.com/305024. | 26 // TODO(stevenjb): Integrate with Sync. crbug.com/305024. |
20 class AppListSyncableService : public BrowserContextKeyedService { | 27 class AppListSyncableService : public BrowserContextKeyedService, |
| 28 public content::NotificationObserver { |
21 public: | 29 public: |
22 explicit AppListSyncableService(Profile* profile); | 30 AppListSyncableService(Profile* profile, |
| 31 extensions::ExtensionSystem* extension_system); |
| 32 |
23 virtual ~AppListSyncableService(); | 33 virtual ~AppListSyncableService(); |
24 | 34 |
25 AppListModel* model() { return model_.get(); } | 35 AppListModel* model() { return model_.get(); } |
26 | 36 |
27 private: | 37 private: |
| 38 void BuildModel(); |
| 39 |
| 40 // content::NotificationObserver: |
| 41 virtual void Observe(int type, |
| 42 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) OVERRIDE; |
| 44 |
28 Profile* profile_; | 45 Profile* profile_; |
| 46 content::NotificationRegistrar registrar_; |
29 scoped_ptr<AppListModel> model_; | 47 scoped_ptr<AppListModel> model_; |
30 scoped_ptr<ExtensionAppModelBuilder> apps_builder_; | 48 scoped_ptr<ExtensionAppModelBuilder> apps_builder_; |
31 | 49 |
32 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); | 50 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); |
33 }; | 51 }; |
34 | 52 |
35 } // namespace app_list | 53 } // namespace app_list |
36 | 54 |
37 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 55 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
OLD | NEW |