Chromium Code Reviews| Index: chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
| diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
| index 3baa7106bd21476f6efd6d861b3a6a1cf042aceb..869d2d173e886a8244e83d50de1cc47e829b48d2 100644 |
| --- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
| +++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc |
| @@ -10,6 +10,7 @@ |
| #include "ash/wm/window_util.h" |
| #include "base/stl_util.h" |
| #include "base/strings/stringprintf.h" |
| +#include "chrome/browser/chromeos/ash_config.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.h" |
| @@ -75,6 +76,24 @@ void ExtensionAppWindowLauncherController::AdditionalUserAddedToSession( |
| registry_.insert(registry); |
| } |
| +void ExtensionAppWindowLauncherController::OnAppWindowAdded( |
| + extensions::AppWindow* app_window) { |
| + // TODO(msw): Determine why this only seems to be called in Mash. Setting the |
|
James Cook
2017/06/08 17:14:00
File a bug for this.
|
| + // ShelfItemType as early as possible is important on Mash, to prevent Ash's |
| + // ShelfWindowWatcher from creating a conflicting ShelfItem. Set the item type |
| + // here for the mash config, and later on in RegisterApp for classic ash. |
| + if (chromeos::GetAshConfig() != ash::Config::MASH) |
| + return; |
| + |
| + const ash::ShelfID shelf_id = GetShelfId(app_window); |
| + DCHECK(!shelf_id.IsNull()); |
| + aura::Window* window = app_window->GetNativeWindow(); |
| + window->SetProperty<int>( |
| + ash::kShelfItemTypeKey, |
| + app_window->window_type_is_panel() ? ash::TYPE_APP_PANEL : ash::TYPE_APP); |
| + window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); |
| +} |
| + |
| void ExtensionAppWindowLauncherController::OnAppWindowShown( |
| AppWindow* app_window, |
| bool was_hidden) { |
| @@ -99,10 +118,19 @@ void ExtensionAppWindowLauncherController::OnWindowDestroying( |
| } |
| void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) { |
| + aura::Window* window = app_window->GetNativeWindow(); |
| const ash::ShelfID shelf_id = GetShelfId(app_window); |
| DCHECK(!shelf_id.IsNull()); |
| - aura::Window* window = app_window->GetNativeWindow(); |
| - window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); |
| + |
| + // TODO(msw): Determine why OnAppWindowAdded only seems to be called in Mash. |
| + if (chromeos::GetAshConfig() != ash::Config::MASH) { |
| + window->SetProperty(ash::kShelfIDKey, |
| + new std::string(shelf_id.Serialize())); |
| + window->SetProperty<int>(ash::kShelfItemTypeKey, |
| + app_window->window_type_is_panel() |
| + ? ash::TYPE_APP_PANEL |
| + : ash::TYPE_APP); |
| + } |
| // Windows created by IME extension should be treated the same way as the |
| // virtual keyboard window, which does not register itself in launcher. |