| OLD | NEW |
| 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/public/cpp/shelf_item_delegate.h" | 7 #include "ash/public/cpp/shelf_item_delegate.h" |
| 8 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 ash::mojom::MenuItemPtr item(ash::mojom::MenuItem::New()); | 52 ash::mojom::MenuItemPtr item(ash::mojom::MenuItem::New()); |
| 53 item->command_id = window_index; | 53 item->command_id = window_index; |
| 54 item->label = app_window->GetTitle(); | 54 item->label = app_window->GetTitle(); |
| 55 | 55 |
| 56 // Use the app's web contents favicon, or the app window's icon. | 56 // Use the app's web contents favicon, or the app window's icon. |
| 57 favicon::FaviconDriver* favicon_driver = | 57 favicon::FaviconDriver* favicon_driver = |
| 58 favicon::ContentFaviconDriver::FromWebContents( | 58 favicon::ContentFaviconDriver::FromWebContents( |
| 59 app_window->web_contents()); | 59 app_window->web_contents()); |
| 60 gfx::Image icon = favicon_driver->GetFavicon(); | 60 gfx::Image icon = favicon_driver->GetFavicon(); |
| 61 if (icon.IsEmpty()) | 61 if (icon.IsEmpty()) { |
| 62 icon = app_window->app_icon(); | 62 const gfx::ImageSkia* app_icon = nullptr; |
| 63 if (app_window->GetNativeWindow()) { |
| 64 app_icon = app_window->GetNativeWindow()->GetProperty( |
| 65 aura::client::kAppIconKey); |
| 66 } |
| 67 if (app_icon && !app_icon->isNull()) |
| 68 icon = gfx::Image(*app_icon); |
| 69 } |
| 63 if (!icon.IsEmpty()) | 70 if (!icon.IsEmpty()) |
| 64 item->image = *icon.ToSkBitmap(); | 71 item->image = *icon.ToSkBitmap(); |
| 65 items.push_back(std::move(item)); | 72 items.push_back(std::move(item)); |
| 66 ++window_index; | 73 ++window_index; |
| 67 } | 74 } |
| 68 return items; | 75 return items; |
| 69 } | 76 } |
| 70 | 77 |
| 71 void ExtensionAppWindowLauncherItemController::ExecuteCommand( | 78 void ExtensionAppWindowLauncherItemController::ExecuteCommand( |
| 72 uint32_t command_id, | 79 uint32_t command_id, |
| 73 int32_t event_flags) { | 80 int32_t event_flags) { |
| 74 ChromeLauncherController::instance()->ActivateShellApp(app_id(), command_id); | 81 ChromeLauncherController::instance()->ActivateShellApp(app_id(), command_id); |
| 75 } | 82 } |
| OLD | NEW |