Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.cc

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Sync and rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/extension_app_window_launcher_item_cont roller.h" 5 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont roller.h"
6 6
7 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/public/cpp/shelf_item_delegate.h"
8 #include "ash/wm/window_state_aura.h" 9 #include "ash/wm/window_state_aura.h"
9 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
10 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
13 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 14 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
14 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
15 #include "components/favicon/content/content_favicon_driver.h" 15 #include "components/favicon/content/content_favicon_driver.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "extensions/browser/app_window/app_window.h" 17 #include "extensions/browser/app_window/app_window.h"
18 #include "extensions/browser/app_window/app_window_registry.h" 18 #include "extensions/browser/app_window/app_window_registry.h"
19 #include "extensions/browser/app_window/native_app_window.h" 19 #include "extensions/browser/app_window/native_app_window.h"
20 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/events/event.h" 22 #include "ui/events/event.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 #include "ui/wm/core/window_animations.h" 24 #include "ui/wm/core/window_animations.h"
25 25
26 ExtensionAppWindowLauncherItemController:: 26 ExtensionAppWindowLauncherItemController::
27 ExtensionAppWindowLauncherItemController( 27 ExtensionAppWindowLauncherItemController(
28 const ash::AppLaunchId& app_launch_id, 28 const ash::AppLaunchId& app_launch_id)
29 ChromeLauncherController* controller) 29 : AppWindowLauncherItemController(app_launch_id) {}
30 : AppWindowLauncherItemController(app_launch_id, controller) {}
31 30
32 ExtensionAppWindowLauncherItemController:: 31 ExtensionAppWindowLauncherItemController::
33 ~ExtensionAppWindowLauncherItemController() {} 32 ~ExtensionAppWindowLauncherItemController() {}
34 33
35 void ExtensionAppWindowLauncherItemController::AddAppWindow( 34 void ExtensionAppWindowLauncherItemController::AddAppWindow(
36 extensions::AppWindow* app_window) { 35 extensions::AppWindow* app_window) {
37 DCHECK(!app_window->window_type_is_panel()); 36 DCHECK(!app_window->window_type_is_panel());
38 AddWindow(app_window->GetBaseWindow()); 37 AddWindow(app_window->GetBaseWindow());
39 } 38 }
40 39
41 MenuItemList ExtensionAppWindowLauncherItemController::GetAppMenuItems( 40 ash::MenuItemList ExtensionAppWindowLauncherItemController::GetAppMenuItems(
42 int event_flags) { 41 int event_flags) {
43 MenuItemList items; 42 ash::MenuItemList items;
44 extensions::AppWindowRegistry* app_window_registry = 43 extensions::AppWindowRegistry* app_window_registry =
45 extensions::AppWindowRegistry::Get(launcher_controller()->profile()); 44 extensions::AppWindowRegistry::Get(
45 ChromeLauncherController::instance()->profile());
46 46
47 uint32_t window_index = 0; 47 uint32_t window_index = 0;
48 for (const ui::BaseWindow* window : windows()) { 48 for (const ui::BaseWindow* window : windows()) {
49 extensions::AppWindow* app_window = 49 extensions::AppWindow* app_window =
50 app_window_registry->GetAppWindowForNativeWindow( 50 app_window_registry->GetAppWindowForNativeWindow(
51 window->GetNativeWindow()); 51 window->GetNativeWindow());
52 DCHECK(app_window); 52 DCHECK(app_window);
53 53
54 ash::mojom::MenuItemPtr item(ash::mojom::MenuItem::New()); 54 ash::mojom::MenuItemPtr item(ash::mojom::MenuItem::New());
55 item->command_id = window_index; 55 item->command_id = window_index;
(...skipping 10 matching lines...) Expand all
66 item->image = *icon.ToSkBitmap(); 66 item->image = *icon.ToSkBitmap();
67 items.push_back(std::move(item)); 67 items.push_back(std::move(item));
68 ++window_index; 68 ++window_index;
69 } 69 }
70 return items; 70 return items;
71 } 71 }
72 72
73 void ExtensionAppWindowLauncherItemController::ExecuteCommand( 73 void ExtensionAppWindowLauncherItemController::ExecuteCommand(
74 uint32_t command_id, 74 uint32_t command_id,
75 int32_t event_flags) { 75 int32_t event_flags) {
76 launcher_controller()->ActivateShellApp(app_id(), command_id); 76 ChromeLauncherController::instance()->ActivateShellApp(app_id(), command_id);
77 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698