OLD | NEW |
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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return shelf_model()->items()[shelf_model()->item_count() - 1]; | 200 return shelf_model()->items()[shelf_model()->item_count() - 1]; |
201 } | 201 } |
202 | 202 |
203 LauncherItemController* GetItemController(ash::ShelfID id) { | 203 LauncherItemController* GetItemController(ash::ShelfID id) { |
204 return controller_->id_to_item_controller_map_[id]; | 204 return controller_->id_to_item_controller_map_[id]; |
205 } | 205 } |
206 | 206 |
207 // Returns the number of menu items, ignoring separators. | 207 // Returns the number of menu items, ignoring separators. |
208 int GetNumApplicationMenuItems(const ash::ShelfItem& item) { | 208 int GetNumApplicationMenuItems(const ash::ShelfItem& item) { |
209 const int event_flags = 0; | 209 const int event_flags = 0; |
210 scoped_ptr<ash::ShelfMenuModel> menu(new LauncherApplicationMenuItemModel( | 210 std::unique_ptr<ash::ShelfMenuModel> menu( |
211 controller_->GetApplicationList(item, event_flags))); | 211 new LauncherApplicationMenuItemModel( |
| 212 controller_->GetApplicationList(item, event_flags))); |
212 int num_items = 0; | 213 int num_items = 0; |
213 for (int i = 0; i < menu->GetItemCount(); ++i) { | 214 for (int i = 0; i < menu->GetItemCount(); ++i) { |
214 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) | 215 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) |
215 ++num_items; | 216 ++num_items; |
216 } | 217 } |
217 return num_items; | 218 return num_items; |
218 } | 219 } |
219 | 220 |
220 // Activate the shelf item with the given |id|. | 221 // Activate the shelf item with the given |id|. |
221 void ActivateShelfItem(int id) { | 222 void ActivateShelfItem(int id) { |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); | 2235 controller_->ActivateApp(bookmark_app->id(), ash::LAUNCH_FROM_APP_LIST, 0); |
2235 | 2236 |
2236 // There should be two new browsers. | 2237 // There should be two new browsers. |
2237 EXPECT_EQ(3u, chrome::GetBrowserCount(browser()->profile())); | 2238 EXPECT_EQ(3u, chrome::GetBrowserCount(browser()->profile())); |
2238 | 2239 |
2239 // The apps should now be running, with the last opened app active. | 2240 // The apps should now be running, with the last opened app active. |
2240 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); | 2241 EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(hosted_app_shelf_id)->status); |
2241 EXPECT_EQ(ash::STATUS_ACTIVE, | 2242 EXPECT_EQ(ash::STATUS_ACTIVE, |
2242 model_->ItemByID(bookmark_app_shelf_id)->status); | 2243 model_->ItemByID(bookmark_app_shelf_id)->status); |
2243 } | 2244 } |
OLD | NEW |