| 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 "components/arc/obb_mounter/arc_obb_mounter_bridge.h" | 5 #include "components/arc/obb_mounter/arc_obb_mounter_bridge.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chromeos/dbus/arc_obb_mounter_client.h" | 8 #include "chromeos/dbus/arc_obb_mounter_client.h" |
| 9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
| 10 #include "components/arc/arc_bridge_service.h" | 10 #include "components/arc/arc_bridge_service.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 : ArcService(bridge_service), binding_(this) { | 25 : ArcService(bridge_service), binding_(this) { |
| 26 arc_bridge_service()->obb_mounter()->AddObserver(this); | 26 arc_bridge_service()->obb_mounter()->AddObserver(this); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ArcObbMounterBridge::~ArcObbMounterBridge() { | 29 ArcObbMounterBridge::~ArcObbMounterBridge() { |
| 30 arc_bridge_service()->obb_mounter()->RemoveObserver(this); | 30 arc_bridge_service()->obb_mounter()->RemoveObserver(this); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ArcObbMounterBridge::OnInstanceReady() { | 33 void ArcObbMounterBridge::OnInstanceReady() { |
| 34 mojom::ObbMounterInstance* obb_mounter_instance = | 34 mojom::ObbMounterInstance* obb_mounter_instance = |
| 35 arc_bridge_service()->obb_mounter()->instance(); | 35 arc_bridge_service()->obb_mounter()->GetInstanceForMethod("Init"); |
| 36 if (!obb_mounter_instance) |
| 37 return; |
| 36 obb_mounter_instance->Init(binding_.CreateInterfacePtrAndBind()); | 38 obb_mounter_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void ArcObbMounterBridge::MountObb(const mojo::String& obb_file, | 41 void ArcObbMounterBridge::MountObb(const mojo::String& obb_file, |
| 40 const mojo::String& target_path, | 42 const mojo::String& target_path, |
| 41 int32_t owner_gid, | 43 int32_t owner_gid, |
| 42 const MountObbCallback& callback) { | 44 const MountObbCallback& callback) { |
| 43 chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->MountObb( | 45 chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->MountObb( |
| 44 obb_file.get(), target_path.get(), owner_gid, | 46 obb_file.get(), target_path.get(), owner_gid, |
| 45 base::Bind(&RunObbCallback, callback)); | 47 base::Bind(&RunObbCallback, callback)); |
| 46 } | 48 } |
| 47 | 49 |
| 48 void ArcObbMounterBridge::UnmountObb(const mojo::String& target_path, | 50 void ArcObbMounterBridge::UnmountObb(const mojo::String& target_path, |
| 49 const UnmountObbCallback& callback) { | 51 const UnmountObbCallback& callback) { |
| 50 chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->UnmountObb( | 52 chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->UnmountObb( |
| 51 target_path.get(), base::Bind(&RunObbCallback, callback)); | 53 target_path.get(), base::Bind(&RunObbCallback, callback)); |
| 52 } | 54 } |
| 53 | 55 |
| 54 } // namespace arc | 56 } // namespace arc |
| OLD | NEW |