#include "chrome/browser/ash/diagnostics/diagnostics_browser_delegate_impl.h"
#include "base/files/file_path.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "components/user_manager/user_manager.h"
namespace ash {
namespace diagnostics {
base::FilePath DiagnosticsBrowserDelegateImpl::GetActiveUserProfileDir() {
if (!user_manager::UserManager::IsInitialized() ||
!user_manager::UserManager::Get()->IsUserLoggedIn()) {
return base::FilePath();
}
auto* user = user_manager::UserManager::Get()->GetActiveUser();
DCHECK(user);
auto* profile = ProfileHelper::Get()->GetProfileByUser(user);
if (profile == nullptr) {
return base::FilePath();
}
return profile->GetPath();
}
}
}