| 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/shelf/app_list_button.h" | 9 #include "ash/common/shelf/app_list_button.h" |
| 10 #include "ash/common/shelf/shelf_button.h" | 10 #include "ash/common/shelf/shelf_button.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 DCHECK_GE(index, 0); | 365 DCHECK_GE(index, 0); |
| 366 ash::ShelfItem item = model_->items()[index]; | 366 ash::ShelfItem item = model_->items()[index]; |
| 367 ash::WmShelf* shelf = | 367 ash::WmShelf* shelf = |
| 368 ash::WmShelf::ForWindow(ash::WmWindow::Get(CurrentContext())); | 368 ash::WmShelf::ForWindow(ash::WmWindow::Get(CurrentContext())); |
| 369 std::unique_ptr<LauncherContextMenu> menu( | 369 std::unique_ptr<LauncherContextMenu> menu( |
| 370 LauncherContextMenu::Create(controller_, &item, shelf)); | 370 LauncherContextMenu::Create(controller_, &item, shelf)); |
| 371 return menu; | 371 return menu; |
| 372 } | 372 } |
| 373 | 373 |
| 374 aura::Window* CurrentContext() { | 374 aura::Window* CurrentContext() { |
| 375 aura::Window* root_window = ash::Shell::GetTargetRootWindow(); | 375 aura::Window* root_window = ash::Shell::GetRootWindowForNewWindows(); |
| 376 DCHECK(root_window); | 376 DCHECK(root_window); |
| 377 return root_window; | 377 return root_window; |
| 378 } | 378 } |
| 379 | 379 |
| 380 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { | 380 bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { |
| 381 return menu->GetIndexOfCommandId(command_id) != -1; | 381 return menu->GetIndexOfCommandId(command_id) != -1; |
| 382 } | 382 } |
| 383 | 383 |
| 384 ash::WmShelf* shelf_; | 384 ash::WmShelf* shelf_; |
| 385 ash::ShelfModel* model_; | 385 ash::ShelfModel* model_; |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 | 2392 |
| 2393 // Close all windows via the menu item. | 2393 // Close all windows via the menu item. |
| 2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2394 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2395 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2396 | 2396 |
| 2397 // Check if "Close" is removed from the context menu. | 2397 // Check if "Close" is removed from the context menu. |
| 2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2398 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2399 ASSERT_FALSE( | 2399 ASSERT_FALSE( |
| 2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2400 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2401 } | 2401 } |
| OLD | NEW |