| 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 "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return shelf_model()->items()[shelf_model()->item_count() - 1]; | 146 return shelf_model()->items()[shelf_model()->item_count() - 1]; |
| 147 } | 147 } |
| 148 | 148 |
| 149 LauncherItemController* GetItemController(ash::LauncherID id) { | 149 LauncherItemController* GetItemController(ash::LauncherID id) { |
| 150 return controller_->id_to_item_controller_map_[id]; | 150 return controller_->id_to_item_controller_map_[id]; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Returns the number of menu items, ignoring separators. | 153 // Returns the number of menu items, ignoring separators. |
| 154 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { | 154 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { |
| 155 const int event_flags = 0; | 155 const int event_flags = 0; |
| 156 scoped_ptr<ash::LauncherMenuModel> menu( | 156 scoped_ptr<ash::ShelfMenuModel> menu(new LauncherApplicationMenuItemModel( |
| 157 new LauncherApplicationMenuItemModel( | 157 controller_->GetApplicationList(item, event_flags))); |
| 158 controller_->GetApplicationList(item, event_flags))); | |
| 159 int num_items = 0; | 158 int num_items = 0; |
| 160 for (int i = 0; i < menu->GetItemCount(); ++i) { | 159 for (int i = 0; i < menu->GetItemCount(); ++i) { |
| 161 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) | 160 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) |
| 162 ++num_items; | 161 ++num_items; |
| 163 } | 162 } |
| 164 return num_items; | 163 return num_items; |
| 165 } | 164 } |
| 166 | 165 |
| 167 // Activate the launcher item with the given |id|. | 166 // Activate the launcher item with the given |id|. |
| 168 void ActivateLauncherItem(int id) { | 167 void ActivateLauncherItem(int id) { |
| (...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 GURL("http://www.foo.com/bar.html")); | 2024 GURL("http://www.foo.com/bar.html")); |
| 2026 // Make sure the navigation was entirely performed. | 2025 // Make sure the navigation was entirely performed. |
| 2027 base::MessageLoop::current()->RunUntilIdle(); | 2026 base::MessageLoop::current()->RunUntilIdle(); |
| 2028 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); | 2027 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); |
| 2029 app_browser->tab_strip_model()->CloseWebContentsAt(0, | 2028 app_browser->tab_strip_model()->CloseWebContentsAt(0, |
| 2030 TabStripModel::CLOSE_NONE); | 2029 TabStripModel::CLOSE_NONE); |
| 2031 // Make sure that the app is really gone. | 2030 // Make sure that the app is really gone. |
| 2032 base::MessageLoop::current()->RunUntilIdle(); | 2031 base::MessageLoop::current()->RunUntilIdle(); |
| 2033 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); | 2032 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); |
| 2034 } | 2033 } |
| OLD | NEW |