| 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_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // First get app_id. | 308 // First get app_id. |
| 309 const Extension* extension = | 309 const Extension* extension = |
| 310 service->GetExtensionById(last_loaded_extension_id(), false); | 310 service->GetExtensionById(last_loaded_extension_id(), false); |
| 311 const std::string app_id = extension->id(); | 311 const std::string app_id = extension->id(); |
| 312 | 312 |
| 313 // Then create a shortcut. | 313 // Then create a shortcut. |
| 314 int item_count = model_->item_count(); | 314 int item_count = model_->item_count(); |
| 315 ash::ShelfID shortcut_id = controller_->CreateAppShortcutLauncherItem( | 315 ash::ShelfID shortcut_id = controller_->CreateAppShortcutLauncherItem( |
| 316 app_id, | 316 app_id, |
| 317 item_count); | 317 item_count); |
| 318 controller_->PersistPinnedState(); | 318 controller_->SyncPinPosition(shortcut_id); |
| 319 EXPECT_EQ(++item_count, model_->item_count()); | 319 EXPECT_EQ(++item_count, model_->item_count()); |
| 320 const ash::ShelfItem& item = *model_->ItemByID(shortcut_id); | 320 const ash::ShelfItem& item = *model_->ItemByID(shortcut_id); |
| 321 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); | 321 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); |
| 322 return item.id; | 322 return item.id; |
| 323 } | 323 } |
| 324 | 324 |
| 325 void RemoveShortcut(ash::ShelfID id) { | 325 void RemoveShortcut(ash::ShelfID id) { |
| 326 controller_->Unpin(id); | 326 controller_->Unpin(id); |
| 327 } | 327 } |
| 328 | 328 |
| (...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 // Close all windows. | 2295 // Close all windows. |
| 2296 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2296 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2297 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2297 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2298 | 2298 |
| 2299 // Check if "Close" is removed from the context menu. | 2299 // Check if "Close" is removed from the context menu. |
| 2300 std::unique_ptr<LauncherContextMenu> menu2 = | 2300 std::unique_ptr<LauncherContextMenu> menu2 = |
| 2301 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); | 2301 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); |
| 2302 ASSERT_FALSE( | 2302 ASSERT_FALSE( |
| 2303 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2303 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2304 } | 2304 } |
| OLD | NEW |