| 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 "ash/common/shelf/shelf_delegate.h" | 5 #include "ash/common/shelf/shelf_delegate.h" |
| 6 #include "ash/common/wm_shell.h" | 6 #include "ash/common/wm_shell.h" |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 void StopInstance() { | 230 void StopInstance() { |
| 231 arc_session_manager()->Shutdown(); | 231 arc_session_manager()->Shutdown(); |
| 232 app_instance_observer()->OnInstanceClosed(); | 232 app_instance_observer()->OnInstanceClosed(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 LauncherItemController* GetAppItemController(const std::string& id) { | 235 LauncherItemController* GetAppItemController(const std::string& id) { |
| 236 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); | 236 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); |
| 237 if (!shelf_id) | 237 if (!shelf_id) |
| 238 return nullptr; | 238 return nullptr; |
| 239 LauncherItemController* controller = | 239 return chrome_controller()->GetLauncherItemController(shelf_id); |
| 240 chrome_controller()->GetLauncherItemController(shelf_id); | |
| 241 if (!controller) | |
| 242 return nullptr; | |
| 243 DCHECK_EQ(LauncherItemController::TYPE_APP, controller->type()); | |
| 244 return controller; | |
| 245 } | 240 } |
| 246 | 241 |
| 247 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } | 242 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } |
| 248 | 243 |
| 249 // Returns as AppHost interface in order to access to private implementation | 244 // Returns as AppHost interface in order to access to private implementation |
| 250 // of the interface. | 245 // of the interface. |
| 251 arc::mojom::AppHost* app_host() { return app_prefs(); } | 246 arc::mojom::AppHost* app_host() { return app_prefs(); } |
| 252 | 247 |
| 253 // Returns as AppInstance observer interface in order to access to private | 248 // Returns as AppInstance observer interface in order to access to private |
| 254 // implementation of the interface. | 249 // implementation of the interface. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 app_host()->OnTaskDestroyed(2); | 496 app_host()->OnTaskDestroyed(2); |
| 502 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); | 497 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); |
| 503 // Destroy task #2, this kills shelf group 2 | 498 // Destroy task #2, this kills shelf group 2 |
| 504 app_host()->OnTaskDestroyed(3); | 499 app_host()->OnTaskDestroyed(3); |
| 505 EXPECT_FALSE(GetAppItemController(shelf_id2)); | 500 EXPECT_FALSE(GetAppItemController(shelf_id2)); |
| 506 | 501 |
| 507 // Disable Arc, this removes app and as result kills shelf group 3. | 502 // Disable Arc, this removes app and as result kills shelf group 3. |
| 508 arc::ArcSessionManager::Get()->DisableArc(); | 503 arc::ArcSessionManager::Get()->DisableArc(); |
| 509 EXPECT_FALSE(GetAppItemController(shelf_id3)); | 504 EXPECT_FALSE(GetAppItemController(shelf_id3)); |
| 510 } | 505 } |
| OLD | NEW |