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