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/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 // For now, use the AppListControllerDelegate associated with the native | 114 // For now, use the AppListControllerDelegate associated with the native |
115 // desktop. TODO(stevenjb): Remove ExtensionAppModelBuilder controller | 115 // desktop. TODO(stevenjb): Remove ExtensionAppModelBuilder controller |
116 // dependency and move the dependent methods from AppListControllerDelegate | 116 // dependency and move the dependent methods from AppListControllerDelegate |
117 // to an extension service delegate associated with this class. | 117 // to an extension service delegate associated with this class. |
118 AppListControllerDelegate* controller = NULL; | 118 AppListControllerDelegate* controller = NULL; |
119 AppListService* service = | 119 AppListService* service = |
120 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | 120 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
121 if (service) | 121 if (service) |
122 controller = service->GetControllerDelegate(); | 122 controller = service->GetControllerDelegate(); |
123 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); | 123 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); |
124 if (CommandLine::ForCurrentProcess()->HasSwitch( | 124 DCHECK(profile_); |
125 if (!profile_->IsOffTheRecord() && | |
stevenjb
2013/12/26 22:34:17
Hmm, I guess this is OK for now. Eventually we wil
tbarzic
2013/12/27 22:35:38
Done.
| |
126 CommandLine::ForCurrentProcess()->HasSwitch( | |
125 switches::kEnableSyncAppList)) { | 127 switches::kEnableSyncAppList)) { |
126 DVLOG(1) << this << ": AppListSyncableService: InitializeWithService."; | 128 DVLOG(1) << this << ": AppListSyncableService: InitializeWithService."; |
127 SyncStarted(); | 129 SyncStarted(); |
128 apps_builder_->InitializeWithService(this); | 130 apps_builder_->InitializeWithService(this); |
129 } else { | 131 } else { |
130 DVLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; | 132 DVLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; |
131 apps_builder_->InitializeWithProfile(profile_, model_.get()); | 133 apps_builder_->InitializeWithProfile(profile_, model_.get()); |
132 } | 134 } |
133 | |
134 DCHECK(profile_); | |
135 } | 135 } |
136 | 136 |
137 void AppListSyncableService::Observe( | 137 void AppListSyncableService::Observe( |
138 int type, | 138 int type, |
139 const content::NotificationSource& source, | 139 const content::NotificationSource& source, |
140 const content::NotificationDetails& details) { | 140 const content::NotificationDetails& details) { |
141 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 141 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
142 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 142 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
143 registrar_.RemoveAll(); | 143 registrar_.RemoveAll(); |
144 BuildModel(); | 144 BuildModel(); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 delete iter->second; | 452 delete iter->second; |
453 sync_items_.erase(iter); | 453 sync_items_.erase(iter); |
454 model_->item_list()->DeleteItem(item_id); | 454 model_->item_list()->DeleteItem(item_id); |
455 } | 455 } |
456 | 456 |
457 std::string AppListSyncableService::SyncItem::ToString() const { | 457 std::string AppListSyncableService::SyncItem::ToString() const { |
458 return item_id.substr(0, 8) + " [" + item_ordinal.ToDebugString() + "]"; | 458 return item_id.substr(0, 8) + " [" + item_ordinal.ToDebugString() + "]"; |
459 } | 459 } |
460 | 460 |
461 } // namespace app_list | 461 } // namespace app_list |
OLD | NEW |