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( |
| 248 new extensions::DriveAppProvider(profile_, model_.get())); |
| 249 } |
| 250 } |
| 251 |
| 252 void AppListSyncableService::Shutdown() { |
| 253 // DriveAppProvider touches other KeyedServices in its dtor and needs be |
| 254 // released in shutdown stage. |
| 255 drive_app_provider_.reset(); |
244 } | 256 } |
245 | 257 |
246 void AppListSyncableService::Observe( | 258 void AppListSyncableService::Observe( |
247 int type, | 259 int type, |
248 const content::NotificationSource& source, | 260 const content::NotificationSource& source, |
249 const content::NotificationDetails& details) { | 261 const content::NotificationDetails& details) { |
250 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 262 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
251 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 263 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
252 registrar_.RemoveAll(); | 264 registrar_.RemoveAll(); |
253 BuildModel(); | 265 BuildModel(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } else { | 817 } else { |
806 res += " { " + item_name + " }"; | 818 res += " { " + item_name + " }"; |
807 res += " [" + item_ordinal.ToDebugString() + "]"; | 819 res += " [" + item_ordinal.ToDebugString() + "]"; |
808 if (!parent_id.empty()) | 820 if (!parent_id.empty()) |
809 res += " <" + parent_id.substr(0, 8) + ">"; | 821 res += " <" + parent_id.substr(0, 8) + ">"; |
810 } | 822 } |
811 return res; | 823 return res; |
812 } | 824 } |
813 | 825 |
814 } // namespace app_list | 826 } // namespace app_list |
OLD | NEW |