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

Side by Side Diff: ui/app_list/test/app_list_test_model.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 "ui/app_list/test/app_list_test_model.h" 5 #include "ui/app_list/test/app_list_test_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/app_list/app_list_constants.h" 15 #include "ui/app_list/app_list_constants.h"
15 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
16 17
17 namespace app_list { 18 namespace app_list {
18 namespace test { 19 namespace test {
19 20
20 gfx::ImageSkia CreateImageSkia(int width, int height) { 21 gfx::ImageSkia CreateImageSkia(int width, int height) {
21 SkBitmap bitmap; 22 SkBitmap bitmap;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 55 }
55 56
56 // AppListTestModel 57 // AppListTestModel
57 58
58 AppListTestModel::AppListTestModel() 59 AppListTestModel::AppListTestModel()
59 : activate_count_(0), 60 : activate_count_(0),
60 last_activated_(NULL) { 61 last_activated_(NULL) {
61 } 62 }
62 63
63 AppListItem* AppListTestModel::AddItem(AppListItem* item) { 64 AppListItem* AppListTestModel::AddItem(AppListItem* item) {
64 return AppListModel::AddItem(make_scoped_ptr(item)); 65 return AppListModel::AddItem(base::WrapUnique(item));
65 } 66 }
66 67
67 AppListItem* AppListTestModel::AddItemToFolder(AppListItem* item, 68 AppListItem* AppListTestModel::AddItemToFolder(AppListItem* item,
68 const std::string& folder_id) { 69 const std::string& folder_id) {
69 return AppListModel::AddItemToFolder(make_scoped_ptr(item), folder_id); 70 return AppListModel::AddItemToFolder(base::WrapUnique(item), folder_id);
70 } 71 }
71 72
72 void AppListTestModel::MoveItemToFolder(AppListItem* item, 73 void AppListTestModel::MoveItemToFolder(AppListItem* item,
73 const std::string& folder_id) { 74 const std::string& folder_id) {
74 AppListModel::MoveItemToFolder(item, folder_id); 75 AppListModel::MoveItemToFolder(item, folder_id);
75 } 76 }
76 77
77 78
78 std::string AppListTestModel::GetItemName(int id) { 79 std::string AppListTestModel::GetItemName(int id) {
79 return base::StringPrintf("Item %d", id); 80 return base::StringPrintf("Item %d", id);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 position = 142 position =
142 top_level_item_list()->item_at(nitems - 1)->position().CreateAfter(); 143 top_level_item_list()->item_at(nitems - 1)->position().CreateAfter();
143 } 144 }
144 item->SetPosition(position); 145 item->SetPosition(position);
145 SetItemName(item, id); 146 SetItemName(item, id);
146 return item; 147 return item;
147 } 148 }
148 149
149 AppListTestModel::AppListTestItem* AppListTestModel::CreateAndAddItem( 150 AppListTestModel::AppListTestItem* AppListTestModel::CreateAndAddItem(
150 const std::string& id) { 151 const std::string& id) {
151 scoped_ptr<AppListTestItem> test_item(CreateItem(id)); 152 std::unique_ptr<AppListTestItem> test_item(CreateItem(id));
152 AppListItem* item = AppListModel::AddItem(std::move(test_item)); 153 AppListItem* item = AppListModel::AddItem(std::move(test_item));
153 return static_cast<AppListTestItem*>(item); 154 return static_cast<AppListTestItem*>(item);
154 } 155 }
155 void AppListTestModel::HighlightItemAt(int index) { 156 void AppListTestModel::HighlightItemAt(int index) {
156 AppListItem* item = top_level_item_list()->item_at(index); 157 AppListItem* item = top_level_item_list()->item_at(index);
157 top_level_item_list()->HighlightItemInstalledFromUI(item->id()); 158 top_level_item_list()->HighlightItemInstalledFromUI(item->id());
158 } 159 }
159 160
160 void AppListTestModel::ItemActivated(AppListTestItem* item) { 161 void AppListTestModel::ItemActivated(AppListTestItem* item) {
161 last_activated_ = item; 162 last_activated_ = item;
162 ++activate_count_; 163 ++activate_count_;
163 } 164 }
164 165
165 } // namespace test 166 } // namespace test
166 } // namespace app_list 167 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/shower/app_list_shower_impl_unittest.cc ('k') | ui/app_list/test/app_list_test_view_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698