#include "chrome/browser/ash/fileapi/recent_model_factory.h"
#include "chrome/browser/ash/arc/fileapi/arc_documents_provider_root_map_factory.h"
#include "chrome/browser/ash/fileapi/recent_model.h"
#include "chrome/browser/profiles/profile.h"
namespace ash {
RecentModel* RecentModelFactory::GetForProfile(Profile* profile) {
return static_cast<RecentModel*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
RecentModelFactory::RecentModelFactory()
: ProfileKeyedServiceFactory(
"RecentModel",
ProfileSelections::Builder()
.WithRegular(ProfileSelection::kRedirectedToOriginal)
.WithGuest(ProfileSelection::kRedirectedToOriginal)
.WithAshInternals(ProfileSelection::kRedirectedToOriginal)
.Build()) {
DependsOn(arc::ArcDocumentsProviderRootMapFactory::GetInstance());
}
RecentModelFactory::~RecentModelFactory() = default;
RecentModelFactory* RecentModelFactory::GetInstance() {
static base::NoDestructor<RecentModelFactory> instance;
return instance.get();
}
std::unique_ptr<KeyedService>
RecentModelFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
return std::make_unique<RecentModel>(profile);
}
}