Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: chrome/browser/ui/app_list/app_list_syncable_service.cc

Issue 1413153007: arc-app-launcher: Minimal support for ARC app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect changes in FakeArcBridgeService Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/browser/apps/drive/drive_app_provider.h" 9 #include "chrome/browser/apps/drive/drive_app_provider.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 20 matching lines...) Expand all
31 #include "ui/app_list/app_list_model.h" 31 #include "ui/app_list/app_list_model.h"
32 #include "ui/app_list/app_list_model_observer.h" 32 #include "ui/app_list/app_list_model_observer.h"
33 #include "ui/app_list/app_list_switches.h" 33 #include "ui/app_list/app_list_switches.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 35
36 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
37 #include "chrome/browser/chromeos/file_manager/app_id.h" 37 #include "chrome/browser/chromeos/file_manager/app_id.h"
38 #include "chrome/browser/chromeos/genius_app/app_id.h" 38 #include "chrome/browser/chromeos/genius_app/app_id.h"
39 #endif 39 #endif
40 40
41 #if defined(ENABLE_ARC)
42 #include "chrome/browser/ui/app_list/arc/arc_app_item.h"
43 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h"
44 #endif
45
41 using syncer::SyncChange; 46 using syncer::SyncChange;
42 47
43 namespace app_list { 48 namespace app_list {
44 49
45 namespace { 50 namespace {
46 51
47 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263"; 52 const char kOemFolderId[] = "ddb1da55-d478-4243-8642-56d3041f0263";
48 53
49 // Prefix for a sync id of a Drive app. Drive app ids are in a different 54 // Prefix for a sync id of a Drive app. Drive app ids are in a different
50 // format and have to be used because a Drive app could have only an URL 55 // format and have to be used because a Drive app could have only an URL
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ExtensionService::UninstallExtensionHelper( 130 ExtensionService::UninstallExtensionHelper(
126 service, id, extensions::UNINSTALL_REASON_SYNC); 131 service, id, extensions::UNINSTALL_REASON_SYNC);
127 } 132 }
128 } 133 }
129 134
130 bool GetAppListItemType(AppListItem* item, 135 bool GetAppListItemType(AppListItem* item,
131 sync_pb::AppListSpecifics::AppListItemType* type) { 136 sync_pb::AppListSpecifics::AppListItemType* type) {
132 const char* item_type = item->GetItemType(); 137 const char* item_type = item->GetItemType();
133 if (item_type == ExtensionAppItem::kItemType) { 138 if (item_type == ExtensionAppItem::kItemType) {
134 *type = sync_pb::AppListSpecifics::TYPE_APP; 139 *type = sync_pb::AppListSpecifics::TYPE_APP;
140 #if defined(ENABLE_ARC)
141 } else if (item_type == ArcAppItem::kItemType) {
142 *type = sync_pb::AppListSpecifics::TYPE_APP;
143 #endif
135 } else if (item_type == AppListFolderItem::kItemType) { 144 } else if (item_type == AppListFolderItem::kItemType) {
136 *type = sync_pb::AppListSpecifics::TYPE_FOLDER; 145 *type = sync_pb::AppListSpecifics::TYPE_FOLDER;
137 } else { 146 } else {
138 LOG(ERROR) << "Unrecognized model type: " << item_type; 147 LOG(ERROR) << "Unrecognized model type: " << item_type;
139 return false; 148 return false;
140 } 149 }
141 return true; 150 return true;
142 } 151 }
143 152
144 bool IsDriveAppSyncId(const std::string& sync_id) { 153 bool IsDriveAppSyncId(const std::string& sync_id) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // For now, use the AppListControllerDelegate associated with the native 267 // For now, use the AppListControllerDelegate associated with the native
259 // desktop. TODO(stevenjb): Remove ExtensionAppModelBuilder controller 268 // desktop. TODO(stevenjb): Remove ExtensionAppModelBuilder controller
260 // dependency and move the dependent methods from AppListControllerDelegate 269 // dependency and move the dependent methods from AppListControllerDelegate
261 // to an extension service delegate associated with this class. 270 // to an extension service delegate associated with this class.
262 AppListControllerDelegate* controller = NULL; 271 AppListControllerDelegate* controller = NULL;
263 AppListService* service = 272 AppListService* service =
264 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); 273 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
265 if (service) 274 if (service)
266 controller = service->GetControllerDelegate(); 275 controller = service->GetControllerDelegate();
267 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); 276 apps_builder_.reset(new ExtensionAppModelBuilder(controller));
277 #if defined(ENABLE_ARC)
278 arc_apps_builder_.reset(new ArcAppModelBuilder(controller));
279 #endif
268 DCHECK(profile_); 280 DCHECK(profile_);
269 if (app_list::switches::IsAppListSyncEnabled()) { 281 if (app_list::switches::IsAppListSyncEnabled()) {
270 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; 282 VLOG(1) << this << ": AppListSyncableService: InitializeWithService.";
271 SyncStarted(); 283 SyncStarted();
272 apps_builder_->InitializeWithService(this, model_.get()); 284 apps_builder_->InitializeWithService(this, model_.get());
285 #if defined(ENABLE_ARC)
286 arc_apps_builder_->InitializeWithService(this, model_.get());
287 #endif
273 } else { 288 } else {
274 VLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; 289 VLOG(1) << this << ": AppListSyncableService: InitializeWithProfile.";
275 apps_builder_->InitializeWithProfile(profile_, model_.get()); 290 apps_builder_->InitializeWithProfile(profile_, model_.get());
291 #if defined(ENABLE_ARC)
292 arc_apps_builder_->InitializeWithProfile(profile_, model_.get());
293 #endif
276 } 294 }
277 295
278 model_pref_updater_.reset( 296 model_pref_updater_.reset(
279 new ModelPrefUpdater(AppListPrefs::Get(profile_), model_.get())); 297 new ModelPrefUpdater(AppListPrefs::Get(profile_), model_.get()));
280 298
281 if (app_list::switches::IsDriveAppsInAppListEnabled()) 299 if (app_list::switches::IsDriveAppsInAppListEnabled())
282 drive_app_provider_.reset(new DriveAppProvider(profile_, this)); 300 drive_app_provider_.reset(new DriveAppProvider(profile_, this));
283 } 301 }
284 302
285 size_t AppListSyncableService::GetNumSyncItemsForTest() { 303 size_t AppListSyncableService::GetNumSyncItemsForTest() {
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 } else { 1013 } else {
996 res += " { " + item_name + " }"; 1014 res += " { " + item_name + " }";
997 res += " [" + item_ordinal.ToDebugString() + "]"; 1015 res += " [" + item_ordinal.ToDebugString() + "]";
998 if (!parent_id.empty()) 1016 if (!parent_id.empty())
999 res += " <" + parent_id.substr(0, 8) + ">"; 1017 res += " <" + parent_id.substr(0, 8) + ">";
1000 } 1018 }
1001 return res; 1019 return res;
1002 } 1020 }
1003 1021
1004 } // namespace app_list 1022 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698