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

Side by Side Diff: ash/common/shelf/shelf_model.cc

Issue 2750463009: mash: Fix ShelfItem mojo struct; add enums and traits. (Closed)
Patch Set: Address comment. Created 3 years, 9 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 | « ash/common/shelf/shelf_model.h ('k') | ash/common/shelf/shelf_model_observer.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 "ash/common/shelf/shelf_model.h" 5 #include "ash/common/shelf/shelf_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/shelf/shelf_model_observer.h" 9 #include "ash/common/shelf/shelf_model_observer.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 int ShelfModel::GetItemIndexForType(ShelfItemType type) { 127 int ShelfModel::GetItemIndexForType(ShelfItemType type) {
128 for (size_t i = 0; i < items_.size(); ++i) { 128 for (size_t i = 0; i < items_.size(); ++i) {
129 if (items_[i].type == type) 129 if (items_[i].type == type)
130 return i; 130 return i;
131 } 131 }
132 return -1; 132 return -1;
133 } 133 }
134 134
135 ShelfItems::const_iterator ShelfModel::ItemByID(int id) const { 135 ShelfItems::const_iterator ShelfModel::ItemByID(ShelfID id) const {
136 for (ShelfItems::const_iterator i = items_.begin(); i != items_.end(); ++i) { 136 for (ShelfItems::const_iterator i = items_.begin(); i != items_.end(); ++i) {
137 if (i->id == id) 137 if (i->id == id)
138 return i; 138 return i;
139 } 139 }
140 return items_.end(); 140 return items_.end();
141 } 141 }
142 142
143 int ShelfModel::FirstRunningAppIndex() const { 143 int ShelfModel::FirstRunningAppIndex() const {
144 ShelfItem weight_dummy; 144 ShelfItem weight_dummy;
145 weight_dummy.type = TYPE_APP; 145 weight_dummy.type = TYPE_APP;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 return index; 202 return index;
203 } 203 }
204 204
205 void ShelfModel::RemoveShelfItemDelegate(ShelfID id) { 205 void ShelfModel::RemoveShelfItemDelegate(ShelfID id) {
206 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) 206 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end())
207 id_to_item_delegate_map_.erase(id); 207 id_to_item_delegate_map_.erase(id);
208 } 208 }
209 209
210 } // namespace ash 210 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_model.h ('k') | ash/common/shelf/shelf_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698