| 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 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| 5 | 5 |
| 6 #include "ash/shelf/shelf_util.h" | 6 #include "ash/shelf/shelf_util.h" |
| 7 #include "ash/wm/common/window_state.h" | 7 #include "ash/wm/common/window_state.h" |
| 8 #include "ash/wm/window_state_aura.h" | 8 #include "ash/wm/window_state_aura.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 12 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 12 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller
.h" | 15 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller
.h" |
| 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 14 #include "components/arc/arc_bridge_service.h" | 17 #include "components/arc/arc_bridge_service.h" |
| 15 #include "components/exo/shell_surface.h" | 18 #include "components/exo/shell_surface.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
| 18 #include "ui/base/base_window.h" | 21 #include "ui/base/base_window.h" |
| 19 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ArcAppListPrefs::GetAppId(package_name, activity_name); | 287 ArcAppListPrefs::GetAppId(package_name, activity_name); |
| 285 | 288 |
| 286 ArcAppWindowLauncherItemController* controller; | 289 ArcAppWindowLauncherItemController* controller; |
| 287 AppControllerMap::iterator it = app_controller_map_.find(app_id); | 290 AppControllerMap::iterator it = app_controller_map_.find(app_id); |
| 288 ash::ShelfID shelf_id = 0; | 291 ash::ShelfID shelf_id = 0; |
| 289 if (it != app_controller_map_.end()) { | 292 if (it != app_controller_map_.end()) { |
| 290 controller = it->second; | 293 controller = it->second; |
| 291 DCHECK_EQ(controller->app_id(), app_id); | 294 DCHECK_EQ(controller->app_id(), app_id); |
| 292 shelf_id = controller->shelf_id(); | 295 shelf_id = controller->shelf_id(); |
| 293 } else { | 296 } else { |
| 294 controller = new ArcAppWindowLauncherItemController(app_id, owner()); | 297 const std::string shelf_app_id = |
| 295 shelf_id = owner()->GetShelfIDForAppID(app_id); | 298 app_id == arc::kPlayStoreAppId ? ArcSupportHost::kHostAppId : app_id; |
| 299 controller = |
| 300 new ArcAppWindowLauncherItemController(shelf_app_id, app_id, owner()); |
| 301 shelf_id = owner()->GetShelfIDForAppID(shelf_app_id); |
| 296 if (shelf_id == 0) { | 302 if (shelf_id == 0) { |
| 297 shelf_id = owner()->CreateAppLauncherItem(controller, app_id, | 303 // Map Play Store shelf icon to Arc Support host, to share one entry. |
| 304 shelf_id = owner()->CreateAppLauncherItem(controller, shelf_app_id, |
| 298 ash::STATUS_RUNNING); | 305 ash::STATUS_RUNNING); |
| 299 } else { | 306 } else { |
| 300 owner()->SetItemController(shelf_id, controller); | 307 owner()->SetItemController(shelf_id, controller); |
| 301 } | 308 } |
| 302 app_controller_map_[app_id] = controller; | 309 app_controller_map_[app_id] = controller; |
| 303 } | 310 } |
| 304 controller->AddWindow(app_window.get()); | 311 controller->AddWindow(app_window.get()); |
| 305 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 312 owner()->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
| 306 app_window->SetController(controller); | 313 app_window->SetController(controller); |
| 307 app_window->set_shelf_id(shelf_id); | 314 app_window->set_shelf_id(shelf_id); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 397 |
| 391 return nullptr; | 398 return nullptr; |
| 392 } | 399 } |
| 393 | 400 |
| 394 void ArcAppWindowLauncherController::OnWindowActivated( | 401 void ArcAppWindowLauncherController::OnWindowActivated( |
| 395 aura::client::ActivationChangeObserver::ActivationReason reason, | 402 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 396 aura::Window* gained_active, | 403 aura::Window* gained_active, |
| 397 aura::Window* lost_active) { | 404 aura::Window* lost_active) { |
| 398 OnTaskSetActive(active_task_id_); | 405 OnTaskSetActive(active_task_id_); |
| 399 } | 406 } |
| OLD | NEW |