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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
31 using syncer::SyncChange; | 31 using syncer::SyncChange; |
32 | 32 |
33 namespace app_list { | 33 namespace app_list { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; | 37 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; |
38 | 38 |
39 bool SyncAppListEnabled() { | |
40 return !CommandLine::ForCurrentProcess()->HasSwitch( | |
41 ::switches::kDisableSyncAppList); | |
42 } | |
43 | |
44 void UpdateSyncItemFromSync(const sync_pb::AppListSpecifics& specifics, | 39 void UpdateSyncItemFromSync(const sync_pb::AppListSpecifics& specifics, |
45 AppListSyncableService::SyncItem* item) { | 40 AppListSyncableService::SyncItem* item) { |
46 DCHECK_EQ(item->item_id, specifics.item_id()); | 41 DCHECK_EQ(item->item_id, specifics.item_id()); |
47 item->item_type = specifics.item_type(); | 42 item->item_type = specifics.item_type(); |
48 item->item_name = specifics.item_name(); | 43 item->item_name = specifics.item_name(); |
49 item->parent_id = specifics.parent_id(); | 44 item->parent_id = specifics.parent_id(); |
50 if (!specifics.page_ordinal().empty()) | 45 if (!specifics.page_ordinal().empty()) |
51 item->page_ordinal = syncer::StringOrdinal(specifics.page_ordinal()); | 46 item->page_ordinal = syncer::StringOrdinal(specifics.page_ordinal()); |
52 if (!specifics.item_ordinal().empty()) | 47 if (!specifics.item_ordinal().empty()) |
53 item->item_ordinal = syncer::StringOrdinal(specifics.item_ordinal()); | 48 item->item_ordinal = syncer::StringOrdinal(specifics.item_ordinal()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // dependency and move the dependent methods from AppListControllerDelegate | 210 // dependency and move the dependent methods from AppListControllerDelegate |
216 // to an extension service delegate associated with this class. | 211 // to an extension service delegate associated with this class. |
217 AppListControllerDelegate* controller = NULL; | 212 AppListControllerDelegate* controller = NULL; |
218 AppListService* service = | 213 AppListService* service = |
219 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | 214 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
220 if (service) | 215 if (service) |
221 controller = service->GetControllerDelegate(); | 216 controller = service->GetControllerDelegate(); |
222 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); | 217 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); |
223 DCHECK(profile_); | 218 DCHECK(profile_); |
224 // TODO(stevenjb): Correctly handle OTR profiles for Guest mode. | 219 // TODO(stevenjb): Correctly handle OTR profiles for Guest mode. |
225 if (!profile_->IsOffTheRecord() && SyncAppListEnabled()) { | 220 // crbug.com/359176. |
| 221 if (!profile_->IsOffTheRecord() && |
| 222 app_list::switches::IsAppListSyncEnabled()) { |
226 DVLOG(1) << this << ": AppListSyncableService: InitializeWithService."; | 223 DVLOG(1) << this << ": AppListSyncableService: InitializeWithService."; |
227 SyncStarted(); | 224 SyncStarted(); |
228 apps_builder_->InitializeWithService(this); | 225 apps_builder_->InitializeWithService(this); |
229 } else { | 226 } else { |
230 DVLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; | 227 DVLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; |
231 apps_builder_->InitializeWithProfile(profile_, model_.get()); | 228 apps_builder_->InitializeWithProfile(profile_, model_.get()); |
232 } | 229 } |
233 } | 230 } |
234 | 231 |
235 void AppListSyncableService::Observe( | 232 void AppListSyncableService::Observe( |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 } else { | 791 } else { |
795 res += " { " + item_name + " }"; | 792 res += " { " + item_name + " }"; |
796 res += " [" + item_ordinal.ToDebugString() + "]"; | 793 res += " [" + item_ordinal.ToDebugString() + "]"; |
797 if (!parent_id.empty()) | 794 if (!parent_id.empty()) |
798 res += " <" + parent_id.substr(0, 8) + ">"; | 795 res += " <" + parent_id.substr(0, 8) + ">"; |
799 } | 796 } |
800 return res; | 797 return res; |
801 } | 798 } |
802 | 799 |
803 } // namespace app_list | 800 } // namespace app_list |
OLD | NEW |