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

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

Issue 25859005: Elim ActivateAppListItem, ChromeAppListItem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fixes Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/test/app_list_test_model.h ('k') | ui/app_list/test/app_list_test_view_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 {
11 namespace test { 11 namespace test {
12 12
13 AppListTestModel::AppListTestModel() { 13 class AppListTestModel::AppListTestItemModel : public AppListItemModel {
14 public:
15 explicit AppListTestItemModel(AppListTestModel* model)
16 : model_(model) {
17 }
18 virtual ~AppListTestItemModel() {}
19
20 virtual void Activate(int event_flags) OVERRIDE {
21 model_->ItemActivated(this);
22 }
23
24 private:
25 AppListTestModel* model_;
26 DISALLOW_COPY_AND_ASSIGN(AppListTestItemModel);
27 };
28
29 AppListTestModel::AppListTestModel()
30 : activate_count_(0),
31 last_activated_(NULL) {
14 SetSignedIn(true); 32 SetSignedIn(true);
15 } 33 }
16 34
17 void AppListTestModel::PopulateApps(int n) { 35 void AppListTestModel::PopulateApps(int n) {
18 for (int i = 0; i < n; ++i) 36 for (int i = 0; i < n; ++i)
19 AddItem(base::StringPrintf("Item %d", i)); 37 AddItem(base::StringPrintf("Item %d", i));
20 } 38 }
21 39
22 void AppListTestModel::PopulateAppWithId(int id) { 40 void AppListTestModel::PopulateAppWithId(int id) {
23 AddItem(base::StringPrintf("Item %d", id)); 41 AddItem(base::StringPrintf("Item %d", id));
(...skipping 23 matching lines...) Expand all
47 void AppListTestModel::AddItem(const std::string& title, 65 void AppListTestModel::AddItem(const std::string& title,
48 const std::string& full_name) { 66 const std::string& full_name) {
49 apps()->Add(CreateItem(title, full_name)); 67 apps()->Add(CreateItem(title, full_name));
50 } 68 }
51 69
52 void AppListTestModel::HighlightItemAt(int index) { 70 void AppListTestModel::HighlightItemAt(int index) {
53 AppListItemModel* item = apps()->GetItemAt(index); 71 AppListItemModel* item = apps()->GetItemAt(index);
54 item->SetHighlighted(true); 72 item->SetHighlighted(true);
55 } 73 }
56 74
75 void AppListTestModel::ItemActivated(AppListTestItemModel* item) {
76 last_activated_ = item;
77 ++activate_count_;
78 }
79
57 } // namespace test 80 } // namespace test
58 } // namespace app_list 81 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/test/app_list_test_model.h ('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