| 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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/resource/resource_bundle.h" |
| 9 | 11 |
| 10 namespace app_list { | 12 namespace app_list { |
| 11 namespace test { | 13 namespace test { |
| 12 | 14 |
| 13 // static | 15 // static |
| 14 const char AppListTestModel::kItemType[] = "TestItem"; | 16 const char AppListTestModel::kItemType[] = "TestItem"; |
| 15 | 17 |
| 16 // AppListTestModel::AppListTestItem | 18 // AppListTestModel::AppListTestItem |
| 17 | 19 |
| 18 AppListTestModel::AppListTestItem::AppListTestItem( | 20 AppListTestModel::AppListTestItem::AppListTestItem( |
| 19 const std::string& id, | 21 const std::string& id, |
| 20 AppListTestModel* model) | 22 AppListTestModel* model) |
| 21 : AppListItem(id), | 23 : AppListItem(id), |
| 22 model_(model) { | 24 model_(model) { |
| 23 } | 25 } |
| 26 |
| 24 AppListTestModel::AppListTestItem::~AppListTestItem() { | 27 AppListTestModel::AppListTestItem::~AppListTestItem() { |
| 25 } | 28 } |
| 26 | 29 |
| 27 void AppListTestModel::AppListTestItem::Activate(int event_flags) { | 30 void AppListTestModel::AppListTestItem::Activate(int event_flags) { |
| 28 model_->ItemActivated(this); | 31 model_->ItemActivated(this); |
| 29 } | 32 } |
| 30 | 33 |
| 31 const char* AppListTestModel::AppListTestItem::GetItemType() const { | 34 const char* AppListTestModel::AppListTestItem::GetItemType() const { |
| 32 return AppListTestModel::kItemType; | 35 return AppListTestModel::kItemType; |
| 33 } | 36 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 AppListItem* AppListTestModel::AddItem(AppListItem* item) { | 50 AppListItem* AppListTestModel::AddItem(AppListItem* item) { |
| 48 return AppListModel::AddItem(make_scoped_ptr(item)); | 51 return AppListModel::AddItem(make_scoped_ptr(item)); |
| 49 } | 52 } |
| 50 | 53 |
| 51 AppListItem* AppListTestModel::AddItemToFolder(AppListItem* item, | 54 AppListItem* AppListTestModel::AddItemToFolder(AppListItem* item, |
| 52 const std::string& folder_id) { | 55 const std::string& folder_id) { |
| 53 return AppListModel::AddItemToFolder(make_scoped_ptr(item), folder_id); | 56 return AppListModel::AddItemToFolder(make_scoped_ptr(item), folder_id); |
| 54 } | 57 } |
| 55 | 58 |
| 56 void AppListTestModel::MoveItemToFolder(AppListItem* item, | 59 void AppListTestModel::MoveItemToFolder(AppListItem* item, |
| 57 const std::string& folder_id) { | 60 const std::string& folder_id) { |
| 58 AppListModel::MoveItemToFolder(item, folder_id); | 61 AppListModel::MoveItemToFolder(item, folder_id); |
| 59 } | 62 } |
| 60 | 63 |
| 61 | 64 |
| 62 std::string AppListTestModel::GetItemName(int id) { | 65 std::string AppListTestModel::GetItemName(int id) { |
| 63 return base::StringPrintf("Item %d", id); | 66 return base::StringPrintf("Item %d", id); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void AppListTestModel::PopulateApps(int n) { | 69 void AppListTestModel::PopulateApps(int n) { |
| 67 int start_index = static_cast<int>(top_level_item_list()->item_count()); | 70 int start_index = static_cast<int>(top_level_item_list()->item_count()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 item->SetHighlighted(true); | 134 item->SetHighlighted(true); |
| 132 } | 135 } |
| 133 | 136 |
| 134 void AppListTestModel::ItemActivated(AppListTestItem* item) { | 137 void AppListTestModel::ItemActivated(AppListTestItem* item) { |
| 135 last_activated_ = item; | 138 last_activated_ = item; |
| 136 ++activate_count_; | 139 ++activate_count_; |
| 137 } | 140 } |
| 138 | 141 |
| 139 } // namespace test | 142 } // namespace test |
| 140 } // namespace app_list | 143 } // namespace app_list |
| OLD | NEW |