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/shelf/shelf_model.h" | |
7 #include "ash/public/cpp/shelf_item_delegate.h" | 6 #include "ash/public/cpp/shelf_item_delegate.h" |
8 #include "ash/shell.h" | 7 #include "ash/shell.h" |
9 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
10 #include "base/macros.h" | 9 #include "base/macros.h" |
11 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chromeos/arc/arc_auth_notification.h" | 13 #include "chrome/browser/chromeos/arc/arc_auth_notification.h" |
15 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" | 14 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
16 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 15 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 app_instance_observer()->OnInstanceReady(); | 252 app_instance_observer()->OnInstanceReady(); |
254 } | 253 } |
255 | 254 |
256 void StopInstance() { | 255 void StopInstance() { |
257 arc_session_manager()->Shutdown(); | 256 arc_session_manager()->Shutdown(); |
258 app_instance_observer()->OnInstanceClosed(); | 257 app_instance_observer()->OnInstanceClosed(); |
259 } | 258 } |
260 | 259 |
261 ash::ShelfItemDelegate* GetAppItemController(const std::string& id) { | 260 ash::ShelfItemDelegate* GetAppItemController(const std::string& id) { |
262 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); | 261 const ash::ShelfID shelf_id = shelf_delegate()->GetShelfIDForAppID(id); |
263 return ash::Shell::Get()->shelf_model()->GetShelfItemDelegate(shelf_id); | 262 if (!shelf_id) |
| 263 return nullptr; |
| 264 return chrome_controller()->GetShelfItemDelegate(shelf_id); |
264 } | 265 } |
265 | 266 |
266 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } | 267 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } |
267 | 268 |
268 // Returns as AppHost interface in order to access to private implementation | 269 // Returns as AppHost interface in order to access to private implementation |
269 // of the interface. | 270 // of the interface. |
270 arc::mojom::AppHost* app_host() { return app_prefs(); } | 271 arc::mojom::AppHost* app_host() { return app_prefs(); } |
271 | 272 |
272 // Returns as AppInstance observer interface in order to access to private | 273 // Returns as AppInstance observer interface in order to access to private |
273 // implementation of the interface. | 274 // implementation of the interface. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 app_host()->OnTaskDestroyed(2); | 546 app_host()->OnTaskDestroyed(2); |
546 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); | 547 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); |
547 // Destroy task #2, this kills shelf group 2 | 548 // Destroy task #2, this kills shelf group 2 |
548 app_host()->OnTaskDestroyed(3); | 549 app_host()->OnTaskDestroyed(3); |
549 EXPECT_FALSE(GetAppItemController(shelf_id2)); | 550 EXPECT_FALSE(GetAppItemController(shelf_id2)); |
550 | 551 |
551 // Disable ARC, this removes app and as result kills shelf group 3. | 552 // Disable ARC, this removes app and as result kills shelf group 3. |
552 arc::SetArcPlayStoreEnabledForProfile(profile(), false); | 553 arc::SetArcPlayStoreEnabledForProfile(profile(), false); |
553 EXPECT_FALSE(GetAppItemController(shelf_id3)); | 554 EXPECT_FALSE(GetAppItemController(shelf_id3)); |
554 } | 555 } |
OLD | NEW |