| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
| 34 #include "extensions/common/one_shot_event.h" | 34 #include "extensions/common/one_shot_event.h" |
| 35 #include "ui/app_list/app_list_folder_item.h" | 35 #include "ui/app_list/app_list_folder_item.h" |
| 36 #include "ui/app_list/app_list_item.h" | 36 #include "ui/app_list/app_list_item.h" |
| 37 #include "ui/app_list/app_list_model.h" | 37 #include "ui/app_list/app_list_model.h" |
| 38 #include "ui/app_list/app_list_model_observer.h" | 38 #include "ui/app_list/app_list_model_observer.h" |
| 39 #include "ui/app_list/app_list_switches.h" | 39 #include "ui/app_list/app_list_switches.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 41 | 41 |
| 42 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 43 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 44 #include "chrome/browser/chromeos/file_manager/app_id.h" | 44 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 45 #include "chrome/browser/chromeos/genius_app/app_id.h" | 45 #include "chrome/browser/chromeos/genius_app/app_id.h" |
| 46 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" | 46 #include "chrome/browser/ui/app_list/arc/arc_app_item.h" |
| 47 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 47 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 48 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h" | 48 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 using syncer::SyncChange; | 51 using syncer::SyncChange; |
| 52 | 52 |
| 53 namespace app_list { | 53 namespace app_list { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 VLOG(2) << owner_ << " OnAppListItemDeleted: " << item->ToDebugString(); | 254 VLOG(2) << owner_ << " OnAppListItemDeleted: " << item->ToDebugString(); |
| 255 // Don't sync folder removal in case the folder still exists on another | 255 // Don't sync folder removal in case the folder still exists on another |
| 256 // device (e.g. with device specific items in it). Empty folders will be | 256 // device (e.g. with device specific items in it). Empty folders will be |
| 257 // deleted when the last item is removed (in PruneEmptySyncFolders()). | 257 // deleted when the last item is removed (in PruneEmptySyncFolders()). |
| 258 if (item->GetItemType() == AppListFolderItem::kItemType) | 258 if (item->GetItemType() == AppListFolderItem::kItemType) |
| 259 return; | 259 return; |
| 260 | 260 |
| 261 #if defined(OS_CHROMEOS) | 261 #if defined(OS_CHROMEOS) |
| 262 if (item->GetItemType() == ArcAppItem::kItemType) { | 262 if (item->GetItemType() == ArcAppItem::kItemType) { |
| 263 // Don't sync remove changes coming as result of disabling Arc. | 263 // Don't sync remove changes coming as result of disabling Arc. |
| 264 const arc::ArcAuthService* auth_service = arc::ArcAuthService::Get(); | 264 const arc::ArcSessionManager* arc_session_manager = |
| 265 DCHECK(auth_service); | 265 arc::ArcSessionManager::Get(); |
| 266 if (!auth_service->IsArcEnabled()) | 266 DCHECK(arc_session_manager); |
| 267 if (!arc_session_manager->IsArcEnabled()) |
| 267 return; | 268 return; |
| 268 } | 269 } |
| 269 #endif | 270 #endif |
| 270 | 271 |
| 271 owner_->RemoveSyncItem(item->id()); | 272 owner_->RemoveSyncItem(item->id()); |
| 272 } | 273 } |
| 273 | 274 |
| 274 void OnAppListItemUpdated(AppListItem* item) override { | 275 void OnAppListItemUpdated(AppListItem* item) override { |
| 275 if (adding_item_) { | 276 if (adding_item_) { |
| 276 // Adding an item may trigger update notifications which should be | 277 // Adding an item may trigger update notifications which should be |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 InitFromLocalStorage(); | 388 InitFromLocalStorage(); |
| 388 | 389 |
| 389 // TODO(calamity): make this a DCHECK after a dev channel release. | 390 // TODO(calamity): make this a DCHECK after a dev channel release. |
| 390 CHECK(IsExtensionServiceReady()); | 391 CHECK(IsExtensionServiceReady()); |
| 391 AppListControllerDelegate* controller = NULL; | 392 AppListControllerDelegate* controller = NULL; |
| 392 AppListService* service = AppListService::Get(); | 393 AppListService* service = AppListService::Get(); |
| 393 if (service) | 394 if (service) |
| 394 controller = service->GetControllerDelegate(); | 395 controller = service->GetControllerDelegate(); |
| 395 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); | 396 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); |
| 396 #if defined(OS_CHROMEOS) | 397 #if defined(OS_CHROMEOS) |
| 397 if (arc::ArcAuthService::IsAllowedForProfile(profile_)) | 398 if (arc::ArcSessionManager::IsAllowedForProfile(profile_)) |
| 398 arc_apps_builder_.reset(new ArcAppModelBuilder(controller)); | 399 arc_apps_builder_.reset(new ArcAppModelBuilder(controller)); |
| 399 #endif | 400 #endif |
| 400 DCHECK(profile_); | 401 DCHECK(profile_); |
| 401 if (app_list::switches::IsAppListSyncEnabled()) { | 402 if (app_list::switches::IsAppListSyncEnabled()) { |
| 402 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; | 403 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; |
| 403 SyncStarted(); | 404 SyncStarted(); |
| 404 apps_builder_->InitializeWithService(this, model_.get()); | 405 apps_builder_->InitializeWithService(this, model_.get()); |
| 405 #if defined(OS_CHROMEOS) | 406 #if defined(OS_CHROMEOS) |
| 406 if (arc_apps_builder_.get()) | 407 if (arc_apps_builder_.get()) |
| 407 arc_apps_builder_->InitializeWithService(this, model_.get()); | 408 arc_apps_builder_->InitializeWithService(this, model_.get()); |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 res += " { " + item_name + " }"; | 1192 res += " { " + item_name + " }"; |
| 1192 res += " [" + item_ordinal.ToDebugString() + "]"; | 1193 res += " [" + item_ordinal.ToDebugString() + "]"; |
| 1193 if (!parent_id.empty()) | 1194 if (!parent_id.empty()) |
| 1194 res += " <" + parent_id.substr(0, 8) + ">"; | 1195 res += " <" + parent_id.substr(0, 8) + ">"; |
| 1195 res += " [" + item_pin_ordinal.ToDebugString() + "]"; | 1196 res += " [" + item_pin_ordinal.ToDebugString() + "]"; |
| 1196 } | 1197 } |
| 1197 return res; | 1198 return res; |
| 1198 } | 1199 } |
| 1199 | 1200 |
| 1200 } // namespace app_list | 1201 } // namespace app_list |
| OLD | NEW |