diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 16:58:53 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 16:58:53 +0000 |
commit | 2b4d20515a62a16c12be5fd30be3a40a630a1e2c (patch) | |
tree | 0b9692acb5f751013880606f97dac13e9d2abaf7 /ash/shelf | |
parent | a18a7ebb718206f6242ad81f4446414ba75bc6c2 (diff) | |
download | chromium_src-2b4d20515a62a16c12be5fd30be3a40a630a1e2c.zip chromium_src-2b4d20515a62a16c12be5fd30be3a40a630a1e2c.tar.gz chromium_src-2b4d20515a62a16c12be5fd30be3a40a630a1e2c.tar.bz2 |
ash: Rename GetLauncherItemIndexForType to GetShelfItemIndexForType().
- move launcher_model_util.* from launcher/ to shelf/
- rename to shelf_model_util.*
BUG=248353
TEST=None, no functional changes
R=harrym@chromium.org,jamescook@chromium.org
Review URL: https://codereview.chromium.org/53513003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r-- | ash/shelf/shelf_model_util.cc | 20 | ||||
-rw-r--r-- | ash/shelf/shelf_model_util.h | 25 |
2 files changed, 45 insertions, 0 deletions
diff --git a/ash/shelf/shelf_model_util.cc b/ash/shelf/shelf_model_util.cc new file mode 100644 index 0000000..c4debdc --- /dev/null +++ b/ash/shelf/shelf_model_util.cc @@ -0,0 +1,20 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/shelf/shelf_model_util.h" + +#include "ash/launcher/launcher_model.h" + +namespace ash { + +int GetShelfItemIndexForType(LauncherItemType type, + const LauncherModel& launcher_model) { + for (size_t i = 0; i < launcher_model.items().size(); i++) { + if (launcher_model.items()[i].type == type) + return i; + } + return -1; +} + +} // namespace ash diff --git a/ash/shelf/shelf_model_util.h b/ash/shelf/shelf_model_util.h new file mode 100644 index 0000000..15433ee --- /dev/null +++ b/ash/shelf/shelf_model_util.h @@ -0,0 +1,25 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SHELF_SHELF_MODEL_UTIL_H_ +#define ASH_SHELF_SHELF_MODEL_UTIL_H_ + +#include "ash/ash_export.h" +#include "ash/launcher/launcher_types.h" + +namespace ash { + +class LauncherModel; + +// Return the index of the |type| from a given |launcher_model|. +// Note: +// * If there are many items for |type| in the |launcher_model|, an index of +// first item will be returned. +// * If there is no item for |type|, -1 will be returned. +ASH_EXPORT int GetShelfItemIndexForType(LauncherItemType type, + const LauncherModel& launcher_model); + +} // namespace ash + +#endif // ASH_SHELF_SHELF_MODEL_UTIL_H_ |