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/apps/drive/drive_app_provider.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Note: model_observer_ is constructed after the initial sync changes are | 227 // Note: model_observer_ is constructed after the initial sync changes are |
228 // received in MergeDataAndStartSyncing(). Changes to the model before that | 228 // received in MergeDataAndStartSyncing(). Changes to the model before that |
229 // will be synced after the initial sync occurs. | 229 // will be synced after the initial sync occurs. |
230 if (extension_system->extension_service() && | 230 if (extension_system->extension_service() && |
231 extension_system->extension_service()->is_ready()) { | 231 extension_system->extension_service()->is_ready()) { |
232 BuildModel(); | 232 BuildModel(); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 // The extensions for this profile have not yet all been loaded. | 236 // The extensions for this profile have not yet all been loaded. |
237 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, | 237 registrar_.Add(this, |
| 238 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, |
238 content::Source<Profile>(profile)); | 239 content::Source<Profile>(profile)); |
239 } | 240 } |
240 | 241 |
241 AppListSyncableService::~AppListSyncableService() { | 242 AppListSyncableService::~AppListSyncableService() { |
242 // Remove observers. | 243 // Remove observers. |
243 model_observer_.reset(); | 244 model_observer_.reset(); |
244 | 245 |
245 STLDeleteContainerPairSecondPointers(sync_items_.begin(), sync_items_.end()); | 246 STLDeleteContainerPairSecondPointers(sync_items_.begin(), sync_items_.end()); |
246 } | 247 } |
247 | 248 |
(...skipping 25 matching lines...) Expand all Loading... |
273 void AppListSyncableService::Shutdown() { | 274 void AppListSyncableService::Shutdown() { |
274 // DriveAppProvider touches other KeyedServices in its dtor and needs be | 275 // DriveAppProvider touches other KeyedServices in its dtor and needs be |
275 // released in shutdown stage. | 276 // released in shutdown stage. |
276 drive_app_provider_.reset(); | 277 drive_app_provider_.reset(); |
277 } | 278 } |
278 | 279 |
279 void AppListSyncableService::Observe( | 280 void AppListSyncableService::Observe( |
280 int type, | 281 int type, |
281 const content::NotificationSource& source, | 282 const content::NotificationSource& source, |
282 const content::NotificationDetails& details) { | 283 const content::NotificationDetails& details) { |
283 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 284 DCHECK_EQ(extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, type); |
284 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 285 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
285 registrar_.RemoveAll(); | 286 registrar_.RemoveAll(); |
286 BuildModel(); | 287 BuildModel(); |
287 } | 288 } |
288 | 289 |
289 const AppListSyncableService::SyncItem* | 290 const AppListSyncableService::SyncItem* |
290 AppListSyncableService::GetSyncItem(const std::string& id) const { | 291 AppListSyncableService::GetSyncItem(const std::string& id) const { |
291 SyncItemMap::const_iterator iter = sync_items_.find(id); | 292 SyncItemMap::const_iterator iter = sync_items_.find(id); |
292 if (iter != sync_items_.end()) | 293 if (iter != sync_items_.end()) |
293 return iter->second; | 294 return iter->second; |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 } else { | 912 } else { |
912 res += " { " + item_name + " }"; | 913 res += " { " + item_name + " }"; |
913 res += " [" + item_ordinal.ToDebugString() + "]"; | 914 res += " [" + item_ordinal.ToDebugString() + "]"; |
914 if (!parent_id.empty()) | 915 if (!parent_id.empty()) |
915 res += " <" + parent_id.substr(0, 8) + ">"; | 916 res += " <" + parent_id.substr(0, 8) + ">"; |
916 } | 917 } |
917 return res; | 918 return res; |
918 } | 919 } |
919 | 920 |
920 } // namespace app_list | 921 } // namespace app_list |
OLD | NEW |