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 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 5 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/apps/drive/drive_app_provider.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/app_list/app_list_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_service.h" |
12 #include "chrome/browser/ui/app_list/extension_app_item.h" | 13 #include "chrome/browser/ui/app_list/extension_app_item.h" |
13 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" | 14 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
14 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
17 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); | 235 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); |
235 DCHECK(profile_); | 236 DCHECK(profile_); |
236 if (app_list::switches::IsAppListSyncEnabled()) { | 237 if (app_list::switches::IsAppListSyncEnabled()) { |
237 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; | 238 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; |
238 SyncStarted(); | 239 SyncStarted(); |
239 apps_builder_->InitializeWithService(this); | 240 apps_builder_->InitializeWithService(this); |
240 } else { | 241 } else { |
241 VLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; | 242 VLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; |
242 apps_builder_->InitializeWithProfile(profile_, model_.get()); | 243 apps_builder_->InitializeWithProfile(profile_, model_.get()); |
243 } | 244 } |
| 245 |
| 246 if (app_list::switches::IsDriveAppsInAppListEnabled()) |
| 247 drive_app_provider_.reset(new DriveAppProvider(profile_)); |
| 248 } |
| 249 |
| 250 void AppListSyncableService::Shutdown() { |
| 251 // DriveAppProvider touches other KeyedServices in its dtor and needs be |
| 252 // released in shutdown stage. |
| 253 drive_app_provider_.reset(); |
244 } | 254 } |
245 | 255 |
246 void AppListSyncableService::Observe( | 256 void AppListSyncableService::Observe( |
247 int type, | 257 int type, |
248 const content::NotificationSource& source, | 258 const content::NotificationSource& source, |
249 const content::NotificationDetails& details) { | 259 const content::NotificationDetails& details) { |
250 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 260 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
251 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 261 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
252 registrar_.RemoveAll(); | 262 registrar_.RemoveAll(); |
253 BuildModel(); | 263 BuildModel(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } else { | 815 } else { |
806 res += " { " + item_name + " }"; | 816 res += " { " + item_name + " }"; |
807 res += " [" + item_ordinal.ToDebugString() + "]"; | 817 res += " [" + item_ordinal.ToDebugString() + "]"; |
808 if (!parent_id.empty()) | 818 if (!parent_id.empty()) |
809 res += " <" + parent_id.substr(0, 8) + ">"; | 819 res += " <" + parent_id.substr(0, 8) + ">"; |
810 } | 820 } |
811 return res; | 821 return res; |
812 } | 822 } |
813 | 823 |
814 } // namespace app_list | 824 } // namespace app_list |
OLD | NEW |