blob: 5bebd822791ee6ec3fbcd84ea7a782425a52af5f [file] [log] [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/crosapi/crosapi_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_helper.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "components/user_manager/user.h"
namespace crosapi {
namespace browser_util {
bool IsSigninProfileOrBelongsToAffiliatedUser(Profile* profile) {
if (ash::IsSigninBrowserContext(profile)) {
return true;
}
if (profile->IsOffTheRecord()) {
return false;
}
const user_manager::User* user =
ash::BrowserContextHelper::Get()->GetUserByBrowserContext(profile);
if (!user) {
return false;
}
return user->IsAffiliated();
}
} // namespace browser_util
} // namespace crosapi