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

Side by Side Diff: ui/app_list/app_list_item_list.cc

Issue 2375383003: Remove std::unique_ptr<>::release() on ScopedVector::insert
Patch Set: Created 4 years, 2 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
« no previous file with comments | « components/sync/engine_impl/cycle/data_type_tracker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/app_list/app_list_item_list.h" 5 #include "ui/app_list/app_list_item_list.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/app_list/app_list_item.h" 8 #include "ui/app_list/app_list_item.h"
9 9
10 namespace app_list { 10 namespace app_list {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return app_list_items_[index - 1]->position().CreateBetween( 171 return app_list_items_[index - 1]->position().CreateBetween(
172 app_list_items_[index]->position()); 172 app_list_items_[index]->position());
173 } 173 }
174 174
175 AppListItem* AppListItemList::AddItem(std::unique_ptr<AppListItem> item_ptr) { 175 AppListItem* AppListItemList::AddItem(std::unique_ptr<AppListItem> item_ptr) {
176 AppListItem* item = item_ptr.get(); 176 AppListItem* item = item_ptr.get();
177 CHECK(std::find(app_list_items_.begin(), app_list_items_.end(), item) 177 CHECK(std::find(app_list_items_.begin(), app_list_items_.end(), item)
178 == app_list_items_.end()); 178 == app_list_items_.end());
179 EnsureValidItemPosition(item); 179 EnsureValidItemPosition(item);
180 size_t index = GetItemSortOrderIndex(item->position(), item->id()); 180 size_t index = GetItemSortOrderIndex(item->position(), item->id());
181 app_list_items_.insert(app_list_items_.begin() + index, item_ptr.release()); 181 app_list_items_.insert(app_list_items_.begin() + index, std::move(item_ptr));
182 FOR_EACH_OBSERVER(AppListItemListObserver, 182 FOR_EACH_OBSERVER(AppListItemListObserver,
183 observers_, 183 observers_,
184 OnListItemAdded(index, item)); 184 OnListItemAdded(index, item));
185 185
186 if (item->id() == highlighted_id_) { 186 if (item->id() == highlighted_id_) {
187 // Item not present when highlight requested, so highlight it now. 187 // Item not present when highlight requested, so highlight it now.
188 item->set_highlighted(true); 188 item->set_highlighted(true);
189 FOR_EACH_OBSERVER(AppListItemListObserver, 189 FOR_EACH_OBSERVER(AppListItemListObserver,
190 observers_, 190 observers_,
191 OnAppListItemHighlight(index, true)); 191 OnAppListItemHighlight(index, true));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 else 269 else
270 cur->set_position(prev->position().CreateAfter()); 270 cur->set_position(prev->position().CreateAfter());
271 prev = cur; 271 prev = cur;
272 } 272 }
273 FOR_EACH_OBSERVER(AppListItemListObserver, 273 FOR_EACH_OBSERVER(AppListItemListObserver,
274 observers_, 274 observers_,
275 OnListItemMoved(index, index, app_list_items_[index])); 275 OnListItemMoved(index, index, app_list_items_[index]));
276 } 276 }
277 277
278 } // namespace app_list 278 } // namespace app_list
OLDNEW
« no previous file with comments | « components/sync/engine_impl/cycle/data_type_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698