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

Side by Side Diff: ash/shelf/shelf_model.h

Issue 68523017: ash: Add GetItemIndexForType() function to ShelfModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | « ash/ash.gyp ('k') | ash/shelf/shelf_model.cc » ('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 #ifndef ASH_SHELF_SHELF_MODEL_H_ 5 #ifndef ASH_SHELF_SHELF_MODEL_H_
6 #define ASH_SHELF_SHELF_MODEL_H_ 6 #define ASH_SHELF_SHELF_MODEL_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/launcher/launcher_types.h" 9 #include "ash/launcher/launcher_types.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 29 matching lines...) Expand all
40 // of the model *after* the item at |index| is removed. 40 // of the model *after* the item at |index| is removed.
41 void Move(int index, int target_index); 41 void Move(int index, int target_index);
42 42
43 // Resets the item at the specified index. The item maintains its existing 43 // Resets the item at the specified index. The item maintains its existing
44 // id and type. 44 // id and type.
45 void Set(int index, const LauncherItem& item); 45 void Set(int index, const LauncherItem& item);
46 46
47 // Returns the index of the item by id. 47 // Returns the index of the item by id.
48 int ItemIndexByID(LauncherID id) const; 48 int ItemIndexByID(LauncherID id) const;
49 49
50 // Returns the |index| of the item matching |type| in |items_|.
51 // Returns -1 if the matching item is not found.
52 // Note: Requires a linear search.
53 int GetItemIndexForType(LauncherItemType type);
54
50 // Returns the index of the first panel or the index where the first panel 55 // Returns the index of the first panel or the index where the first panel
51 // would go if there are no panels. 56 // would go if there are no panels.
52 int FirstPanelIndex() const; 57 int FirstPanelIndex() const;
53 58
54 // Returns the id assigned to the next item added. 59 // Returns the id assigned to the next item added.
55 LauncherID next_id() const { return next_id_; } 60 LauncherID next_id() const { return next_id_; }
56 61
57 // Returns a reserved id which will not be used by the |ShelfModel|. 62 // Returns a reserved id which will not be used by the |ShelfModel|.
58 LauncherID reserve_external_id() { return next_id_++; } 63 LauncherID reserve_external_id() { return next_id_++; }
59 64
(...skipping 22 matching lines...) Expand all
82 LauncherItems items_; 87 LauncherItems items_;
83 Status status_; 88 Status status_;
84 ObserverList<ShelfModelObserver> observers_; 89 ObserverList<ShelfModelObserver> observers_;
85 90
86 DISALLOW_COPY_AND_ASSIGN(ShelfModel); 91 DISALLOW_COPY_AND_ASSIGN(ShelfModel);
87 }; 92 };
88 93
89 } // namespace ash 94 } // namespace ash
90 95
91 #endif // ASH_SHELF_SHELF_MODEL_H_ 96 #endif // ASH_SHELF_SHELF_MODEL_H_
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/shelf/shelf_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698