| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 base::Optional<MenuItemList>) { | 102 base::Optional<MenuItemList>) { |
| 103 *action_taken = action; | 103 *action_taken = action; |
| 104 run_loop->Quit(); | 104 run_loop->Quit(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Calls ShelfItemDelegate::SelectItem with an event type and default arguments. | 107 // Calls ShelfItemDelegate::SelectItem with an event type and default arguments. |
| 108 ash::ShelfAction SelectItem(ash::mojom::ShelfItemDelegate* delegate, | 108 ash::ShelfAction SelectItem(ash::mojom::ShelfItemDelegate* delegate, |
| 109 ui::EventType event_type) { | 109 ui::EventType event_type) { |
| 110 std::unique_ptr<ui::Event> event; | 110 std::unique_ptr<ui::Event> event; |
| 111 if (event_type == ui::ET_MOUSE_PRESSED) { | 111 if (event_type == ui::ET_MOUSE_PRESSED) { |
| 112 event = | 112 event = base::MakeUnique<ui::MouseEvent>( |
| 113 base::MakeUnique<ui::MouseEvent>(event_type, gfx::Point(), gfx::Point(), | 113 event_type, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 114 ui::EventTimeForNow(), ui::EF_NONE, 0); | 114 ui::EF_NONE, 0, |
| 115 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 115 } else if (event_type == ui::ET_KEY_RELEASED) { | 116 } else if (event_type == ui::ET_KEY_RELEASED) { |
| 116 event = base::MakeUnique<ui::KeyEvent>(event_type, ui::VKEY_UNKNOWN, | 117 event = base::MakeUnique<ui::KeyEvent>(event_type, ui::VKEY_UNKNOWN, |
| 117 ui::EF_NONE); | 118 ui::EF_NONE); |
| 118 } | 119 } |
| 119 | 120 |
| 120 base::RunLoop run_loop; | 121 base::RunLoop run_loop; |
| 121 ash::ShelfAction action = ash::SHELF_ACTION_NONE; | 122 ash::ShelfAction action = ash::SHELF_ACTION_NONE; |
| 122 delegate->ItemSelected(std::move(event), display::kInvalidDisplayId, | 123 delegate->ItemSelected(std::move(event), display::kInvalidDisplayId, |
| 123 ash::LAUNCH_FROM_UNKNOWN, | 124 ash::LAUNCH_FROM_UNKNOWN, |
| 124 base::Bind(&SelectItemCallback, &action, &run_loop)); | 125 base::Bind(&SelectItemCallback, &action, &run_loop)); |
| (...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 | 2407 |
| 2407 // Close all windows via the menu item. | 2408 // Close all windows via the menu item. |
| 2408 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2409 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2409 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2410 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2410 | 2411 |
| 2411 // Check if "Close" is removed from the context menu. | 2412 // Check if "Close" is removed from the context menu. |
| 2412 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2413 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2413 ASSERT_FALSE( | 2414 ASSERT_FALSE( |
| 2414 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2415 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2415 } | 2416 } |
| OLD | NEW |