Index: ui/app_list/app_list_model.cc |
diff --git a/ui/app_list/app_list_model.cc b/ui/app_list/app_list_model.cc |
index 9abd67a1f1b88baeaa924525a45f2a125bc36de4..cf713d1a2a1a057452f2e7eb240b86da787024ef 100644 |
--- a/ui/app_list/app_list_model.cc |
+++ b/ui/app_list/app_list_model.cc |
@@ -80,13 +80,13 @@ AppListFolderItem* AppListModel::FindFolderItem(const std::string& id) { |
return NULL; |
} |
-AppListItem* AppListModel::AddItem(scoped_ptr<AppListItem> item) { |
+AppListItem* AppListModel::AddItem(std::unique_ptr<AppListItem> item) { |
DCHECK(!item->IsInFolder()); |
DCHECK(!top_level_item_list()->FindItem(item->id())); |
return AddItemToItemListAndNotify(std::move(item)); |
} |
-AppListItem* AppListModel::AddItemToFolder(scoped_ptr<AppListItem> item, |
+AppListItem* AppListModel::AddItemToFolder(std::unique_ptr<AppListItem> item, |
const std::string& folder_id) { |
if (folder_id.empty()) |
return AddItem(std::move(item)); |
@@ -136,7 +136,7 @@ const std::string AppListModel::MergeItems(const std::string& target_item_id, |
LOG(WARNING) << "MergeItems called with OEM folder as target"; |
return ""; |
} |
- scoped_ptr<AppListItem> source_item_ptr = RemoveItem(source_item); |
+ std::unique_ptr<AppListItem> source_item_ptr = RemoveItem(source_item); |
source_item_ptr->set_position( |
target_folder->item_list()->CreatePositionBefore( |
syncer::StringOrdinal())); |
@@ -146,18 +146,18 @@ const std::string AppListModel::MergeItems(const std::string& target_item_id, |
// Otherwise remove the source item and target item from their current |
// location, they will become owned by the new folder. |
- scoped_ptr<AppListItem> source_item_ptr = RemoveItem(source_item); |
+ std::unique_ptr<AppListItem> source_item_ptr = RemoveItem(source_item); |
CHECK(source_item_ptr); |
// Note: This would fail if |target_item_id == source_item_id|, except we |
// checked that they are distinct at the top of this method. |
- scoped_ptr<AppListItem> target_item_ptr = |
+ std::unique_ptr<AppListItem> target_item_ptr = |
top_level_item_list_->RemoveItem(target_item_id); |
CHECK(target_item_ptr); |
// Create a new folder in the same location as the target item. |
std::string new_folder_id = AppListFolderItem::GenerateId(); |
DVLOG(2) << "Creating folder for merge: " << new_folder_id; |
- scoped_ptr<AppListItem> new_folder_ptr(new AppListFolderItem( |
+ std::unique_ptr<AppListItem> new_folder_ptr(new AppListFolderItem( |
new_folder_id, AppListFolderItem::FOLDER_TYPE_NORMAL)); |
new_folder_ptr->set_position(target_item_ptr->position()); |
AppListFolderItem* new_folder = static_cast<AppListFolderItem*>( |
@@ -183,7 +183,7 @@ void AppListModel::MoveItemToFolder(AppListItem* item, |
if (item->folder_id() == folder_id) |
return; |
AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id); |
- scoped_ptr<AppListItem> item_ptr = RemoveItem(item); |
+ std::unique_ptr<AppListItem> item_ptr = RemoveItem(item); |
if (dest_folder) { |
CHECK(!item->IsInFolder()); |
AddItemToFolderItemAndNotify(dest_folder, std::move(item_ptr)); |
@@ -207,7 +207,7 @@ bool AppListModel::MoveItemToFolderAt(AppListItem* item, |
return false; |
} |
AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id); |
- scoped_ptr<AppListItem> item_ptr = RemoveItem(item); |
+ std::unique_ptr<AppListItem> item_ptr = RemoveItem(item); |
if (dest_folder) { |
item_ptr->set_position( |
dest_folder->item_list()->CreatePositionBefore(position)); |
@@ -272,7 +272,7 @@ void AppListModel::DeleteItem(const std::string& id) { |
} |
AppListFolderItem* folder = FindFolderItem(item->folder_id()); |
DCHECK(folder) << "Folder not found for item: " << item->ToDebugString(); |
- scoped_ptr<AppListItem> child_item = RemoveItemFromFolder(folder, item); |
+ std::unique_ptr<AppListItem> child_item = RemoveItemFromFolder(folder, item); |
DCHECK_EQ(item, child_item.get()); |
FOR_EACH_OBSERVER(AppListModelObserver, |
observers_, |
@@ -316,7 +316,7 @@ void AppListModel::SetFoldersEnabled(bool folders_enabled) { |
if (folder->folder_type() == AppListFolderItem::FOLDER_TYPE_OEM) |
continue; // Do not remove OEM folders. |
while (folder->item_list()->item_count()) { |
- scoped_ptr<AppListItem> child = folder->item_list()->RemoveItemAt(0); |
+ std::unique_ptr<AppListItem> child = folder->item_list()->RemoveItemAt(0); |
child->set_folder_id(""); |
AddItemToItemListAndNotifyUpdate(std::move(child)); |
} |
@@ -396,7 +396,7 @@ AppListFolderItem* AppListModel::FindOrCreateFolderItem( |
} |
DVLOG(2) << "Creating new folder: " << folder_id; |
- scoped_ptr<AppListFolderItem> new_folder( |
+ std::unique_ptr<AppListFolderItem> new_folder( |
new AppListFolderItem(folder_id, AppListFolderItem::FOLDER_TYPE_NORMAL)); |
new_folder->set_position( |
top_level_item_list_->CreatePositionBefore(syncer::StringOrdinal())); |
@@ -406,7 +406,7 @@ AppListFolderItem* AppListModel::FindOrCreateFolderItem( |
} |
AppListItem* AppListModel::AddItemToItemListAndNotify( |
- scoped_ptr<AppListItem> item_ptr) { |
+ std::unique_ptr<AppListItem> item_ptr) { |
DCHECK(!item_ptr->IsInFolder()); |
AppListItem* item = top_level_item_list_->AddItem(std::move(item_ptr)); |
FOR_EACH_OBSERVER(AppListModelObserver, |
@@ -416,7 +416,7 @@ AppListItem* AppListModel::AddItemToItemListAndNotify( |
} |
AppListItem* AppListModel::AddItemToItemListAndNotifyUpdate( |
- scoped_ptr<AppListItem> item_ptr) { |
+ std::unique_ptr<AppListItem> item_ptr) { |
DCHECK(!item_ptr->IsInFolder()); |
AppListItem* item = top_level_item_list_->AddItem(std::move(item_ptr)); |
FOR_EACH_OBSERVER(AppListModelObserver, |
@@ -427,7 +427,7 @@ AppListItem* AppListModel::AddItemToItemListAndNotifyUpdate( |
AppListItem* AppListModel::AddItemToFolderItemAndNotify( |
AppListFolderItem* folder, |
- scoped_ptr<AppListItem> item_ptr) { |
+ std::unique_ptr<AppListItem> item_ptr) { |
CHECK_NE(folder->id(), item_ptr->folder_id()); |
AppListItem* item = folder->item_list()->AddItem(std::move(item_ptr)); |
item->set_folder_id(folder->id()); |
@@ -437,7 +437,7 @@ AppListItem* AppListModel::AddItemToFolderItemAndNotify( |
return item; |
} |
-scoped_ptr<AppListItem> AppListModel::RemoveItem(AppListItem* item) { |
+std::unique_ptr<AppListItem> AppListModel::RemoveItem(AppListItem* item) { |
if (!item->IsInFolder()) |
return top_level_item_list_->RemoveItem(item->id()); |
@@ -445,12 +445,13 @@ scoped_ptr<AppListItem> AppListModel::RemoveItem(AppListItem* item) { |
return RemoveItemFromFolder(folder, item); |
} |
-scoped_ptr<AppListItem> AppListModel::RemoveItemFromFolder( |
+std::unique_ptr<AppListItem> AppListModel::RemoveItemFromFolder( |
AppListFolderItem* folder, |
AppListItem* item) { |
std::string folder_id = folder->id(); |
CHECK_EQ(item->folder_id(), folder_id); |
- scoped_ptr<AppListItem> result = folder->item_list()->RemoveItem(item->id()); |
+ std::unique_ptr<AppListItem> result = |
+ folder->item_list()->RemoveItem(item->id()); |
result->set_folder_id(""); |
if (folder->item_list()->item_count() == 0) { |
DVLOG(2) << "Deleting empty folder: " << folder->ToDebugString(); |