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

Side by Side Diff: ash/launcher/launcher_util.cc

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for LauncherTest and observing LauncherModel in DelegateManager Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/launcher/launcher_util.h" 5 #include "ash/launcher/launcher_util.h"
6 6
7 #include "ash/launcher/launcher_model.h" 7 #include "ash/launcher/launcher_model.h"
8 #include "ash/launcher/launcher_types.h"
9 8
10 namespace ash { 9 namespace ash {
11 namespace launcher { 10 namespace launcher {
12 11
13 int GetBrowserItemIndex(const LauncherModel& launcher_model) { 12 int GetBrowserItemIndex(const LauncherModel& launcher_model) {
14 for (size_t i = 0; i < launcher_model.items().size(); i++) { 13 for (size_t i = 0; i < launcher_model.items().size(); i++) {
15 if (launcher_model.items()[i].type == ash::TYPE_BROWSER_SHORTCUT) 14 if (launcher_model.items()[i].type == ash::TYPE_BROWSER_SHORTCUT)
16 return i; 15 return i;
17 } 16 }
18 return -1; 17 return -1;
19 } 18 }
20 19
20 ash::LauncherID GetBrowserItemID(const LauncherModel& launcher_model) {
21 for (size_t i = 0; i < launcher_model.items().size(); i++) {
22 if (launcher_model.items()[i].type == ash::TYPE_BROWSER_SHORTCUT)
23 return launcher_model.items()[i].id;
24 }
25 return 0;
26 }
27
28 ash::LauncherID GetAppListItemID(const LauncherModel& launcher_model) {
29 for (size_t i = 0; i < launcher_model.items().size(); i++) {
30 if (launcher_model.items()[i].type == ash::TYPE_APP_LIST)
31 return launcher_model.items()[i].id;
32 }
33 return 0;
34 }
35
21 } // namespace launcher 36 } // namespace launcher
22 } // namespace ash 37 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698