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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months 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 <utility>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
10 #include "build/build_config.h" 12 #include "build/build_config.h"
11 #include "chrome/browser/apps/drive/drive_app_provider.h" 13 #include "chrome/browser/apps/drive/drive_app_provider.h"
12 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/app_list/app_list_prefs.h" 16 #include "chrome/browser/ui/app_list/app_list_prefs.h"
15 #include "chrome/browser/ui/app_list/app_list_service.h" 17 #include "chrome/browser/ui/app_list/app_list_service.h"
16 #include "chrome/browser/ui/app_list/extension_app_item.h" 18 #include "chrome/browser/ui/app_list/extension_app_item.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (AppIsOem(app_item->id())) { 377 if (AppIsOem(app_item->id())) {
376 folder_id = FindOrCreateOemFolder(); 378 folder_id = FindOrCreateOemFolder();
377 VLOG_IF(2, !folder_id.empty()) 379 VLOG_IF(2, !folder_id.empty())
378 << this << ": AddItem to OEM folder: " << sync_item->ToString(); 380 << this << ": AddItem to OEM folder: " << sync_item->ToString();
379 } else { 381 } else {
380 folder_id = sync_item->parent_id; 382 folder_id = sync_item->parent_id;
381 } 383 }
382 } 384 }
383 VLOG(2) << this << ": AddItem: " << sync_item->ToString() 385 VLOG(2) << this << ": AddItem: " << sync_item->ToString()
384 << " Folder: '" << folder_id << "'"; 386 << " Folder: '" << folder_id << "'";
385 model_->AddItemToFolder(app_item.Pass(), folder_id); 387 model_->AddItemToFolder(std::move(app_item), folder_id);
386 } 388 }
387 389
388 AppListSyncableService::SyncItem* AppListSyncableService::FindOrAddSyncItem( 390 AppListSyncableService::SyncItem* AppListSyncableService::FindOrAddSyncItem(
389 AppListItem* app_item) { 391 AppListItem* app_item) {
390 const std::string& item_id = app_item->id(); 392 const std::string& item_id = app_item->id();
391 if (item_id.empty()) { 393 if (item_id.empty()) {
392 LOG(ERROR) << "AppListItem item with empty ID"; 394 LOG(ERROR) << "AppListItem item with empty ID";
393 return NULL; 395 return NULL;
394 } 396 }
395 SyncItem* sync_item = FindSyncItem(item_id); 397 SyncItem* sync_item = FindSyncItem(item_id);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 const syncer::SyncDataList& initial_sync_data, 594 const syncer::SyncDataList& initial_sync_data,
593 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, 595 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
594 scoped_ptr<syncer::SyncErrorFactory> error_handler) { 596 scoped_ptr<syncer::SyncErrorFactory> error_handler) {
595 DCHECK(!sync_processor_.get()); 597 DCHECK(!sync_processor_.get());
596 DCHECK(sync_processor.get()); 598 DCHECK(sync_processor.get());
597 DCHECK(error_handler.get()); 599 DCHECK(error_handler.get());
598 600
599 // Ensure the model is built. 601 // Ensure the model is built.
600 GetModel(); 602 GetModel();
601 603
602 sync_processor_ = sync_processor.Pass(); 604 sync_processor_ = std::move(sync_processor);
603 sync_error_handler_ = error_handler.Pass(); 605 sync_error_handler_ = std::move(error_handler);
604 if (switches::IsFolderUIEnabled()) 606 if (switches::IsFolderUIEnabled())
605 model_->SetFoldersEnabled(true); 607 model_->SetFoldersEnabled(true);
606 608
607 syncer::SyncMergeResult result = syncer::SyncMergeResult(type); 609 syncer::SyncMergeResult result = syncer::SyncMergeResult(type);
608 result.set_num_items_before_association(sync_items_.size()); 610 result.set_num_items_before_association(sync_items_.size());
609 VLOG(1) << this << ": MergeDataAndStartSyncing: " 611 VLOG(1) << this << ": MergeDataAndStartSyncing: "
610 << initial_sync_data.size(); 612 << initial_sync_data.size();
611 613
612 // Copy all sync items to |unsynced_items|. 614 // Copy all sync items to |unsynced_items|.
613 std::set<std::string> unsynced_items; 615 std::set<std::string> unsynced_items;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 } 932 }
931 } 933 }
932 } 934 }
933 935
934 std::string AppListSyncableService::FindOrCreateOemFolder() { 936 std::string AppListSyncableService::FindOrCreateOemFolder() {
935 AppListFolderItem* oem_folder = model_->FindFolderItem(kOemFolderId); 937 AppListFolderItem* oem_folder = model_->FindFolderItem(kOemFolderId);
936 if (!oem_folder) { 938 if (!oem_folder) {
937 scoped_ptr<AppListFolderItem> new_folder(new AppListFolderItem( 939 scoped_ptr<AppListFolderItem> new_folder(new AppListFolderItem(
938 kOemFolderId, AppListFolderItem::FOLDER_TYPE_OEM)); 940 kOemFolderId, AppListFolderItem::FOLDER_TYPE_OEM));
939 oem_folder = 941 oem_folder =
940 static_cast<AppListFolderItem*>(model_->AddItem(new_folder.Pass())); 942 static_cast<AppListFolderItem*>(model_->AddItem(std::move(new_folder)));
941 SyncItem* oem_sync_item = FindSyncItem(kOemFolderId); 943 SyncItem* oem_sync_item = FindSyncItem(kOemFolderId);
942 if (oem_sync_item) { 944 if (oem_sync_item) {
943 VLOG(1) << "Creating OEM folder from existing sync item: " 945 VLOG(1) << "Creating OEM folder from existing sync item: "
944 << oem_sync_item->item_ordinal.ToDebugString(); 946 << oem_sync_item->item_ordinal.ToDebugString();
945 model_->SetItemPosition(oem_folder, oem_sync_item->item_ordinal); 947 model_->SetItemPosition(oem_folder, oem_sync_item->item_ordinal);
946 } else { 948 } else {
947 model_->SetItemPosition(oem_folder, GetOemFolderPos()); 949 model_->SetItemPosition(oem_folder, GetOemFolderPos());
948 // Do not create a sync item for the OEM folder here, do it in 950 // Do not create a sync item for the OEM folder here, do it in
949 // ResolveFolderPositions() when the item position is finalized. 951 // ResolveFolderPositions() when the item position is finalized.
950 } 952 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 } else { 1014 } else {
1013 res += " { " + item_name + " }"; 1015 res += " { " + item_name + " }";
1014 res += " [" + item_ordinal.ToDebugString() + "]"; 1016 res += " [" + item_ordinal.ToDebugString() + "]";
1015 if (!parent_id.empty()) 1017 if (!parent_id.empty())
1016 res += " <" + parent_id.substr(0, 8) + ">"; 1018 res += " <" + parent_id.substr(0, 8) + ">";
1017 } 1019 }
1018 return res; 1020 return res;
1019 } 1021 }
1020 1022
1021 } // namespace app_list 1023 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_shower_views_unittest.cc ('k') | chrome/browser/ui/app_list/fast_show_pickler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698