| 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 "ui/app_list/test/app_list_test_model.h" | 5 #include "ui/app_list/test/app_list_test_model.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "ui/app_list/app_list_item_model.h" | 8 #include "ui/app_list/app_list_item_model.h" |
| 9 | 9 |
| 10 namespace app_list { | 10 namespace app_list { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 std::string AppListTestModel::GetModelContent() { | 26 std::string AppListTestModel::GetModelContent() { |
| 27 std::string content; | 27 std::string content; |
| 28 for (size_t i = 0; i < apps()->item_count(); ++i) { | 28 for (size_t i = 0; i < apps()->item_count(); ++i) { |
| 29 if (i > 0) | 29 if (i > 0) |
| 30 content += ','; | 30 content += ','; |
| 31 content += apps()->GetItemAt(i)->title(); | 31 content += apps()->GetItemAt(i)->title(); |
| 32 } | 32 } |
| 33 return content; | 33 return content; |
| 34 } | 34 } |
| 35 | 35 |
| 36 AppListItemModel* AppListTestModel::CreateItem(const std::string& title) { | 36 AppListItemModel* AppListTestModel::CreateItem(const std::string& title, |
| 37 const std::string& full_name) { |
| 37 AppListItemModel* item = new AppListItemModel; | 38 AppListItemModel* item = new AppListItemModel; |
| 38 item->SetTitle(title); | 39 item->SetName(title, full_name); |
| 39 return item; | 40 return item; |
| 40 } | 41 } |
| 41 | 42 |
| 42 void AppListTestModel::AddItem(const std::string& title) { | 43 void AppListTestModel::AddItem(const std::string& title) { |
| 43 apps()->Add(CreateItem(title)); | 44 apps()->Add(CreateItem(title, title)); |
| 45 } |
| 46 |
| 47 void AppListTestModel::AddItem(const std::string& title, |
| 48 const std::string& full_name) { |
| 49 apps()->Add(CreateItem(title, full_name)); |
| 44 } | 50 } |
| 45 | 51 |
| 46 void AppListTestModel::HighlightItemAt(int index) { | 52 void AppListTestModel::HighlightItemAt(int index) { |
| 47 AppListItemModel* item = apps()->GetItemAt(index); | 53 AppListItemModel* item = apps()->GetItemAt(index); |
| 48 item->SetHighlighted(true); | 54 item->SetHighlighted(true); |
| 49 } | 55 } |
| 50 | 56 |
| 51 } // namespace test | 57 } // namespace test |
| 52 } // namespace app_list | 58 } // namespace app_list |
| OLD | NEW |