1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/chromeos/arc/session/adb_sideloading_availability_delegate_impl.h"
6 
7 #include "chrome/browser/chromeos/crostini/crostini_features.h"
8 
9 namespace arc {
10 
11 AdbSideloadingAvailabilityDelegateImpl::
12     AdbSideloadingAvailabilityDelegateImpl() = default;
13 
14 AdbSideloadingAvailabilityDelegateImpl::
15     ~AdbSideloadingAvailabilityDelegateImpl() = default;
16 
SetProfile(Profile * profile)17 void AdbSideloadingAvailabilityDelegateImpl::SetProfile(Profile* profile) {
18   profile_ = profile;
19 }
20 
CanChangeAdbSideloading(base::OnceCallback<void (bool can_change_adb_sideloading)> callback)21 void AdbSideloadingAvailabilityDelegateImpl::CanChangeAdbSideloading(
22     base::OnceCallback<void(bool can_change_adb_sideloading)> callback) {
23   if (!profile_) {
24     // If |profile_| is not set, return immediately and mark adb sideloading as
25     // not allowed
26     std::move(callback).Run(false);
27     return;
28   }
29 
30   crostini::CrostiniFeatures::Get()->CanChangeAdbSideloading(
31       profile_, std::move(callback));
32 }
33 
34 }  // namespace arc
35