#include "chrome/browser/paint_preview/services/paint_preview_tab_service_factory.h"
#include <utility>
#include "build/build_config.h"
#include "chrome/browser/paint_preview/services/paint_preview_tab_service.h"
#include "chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.h"
#include "components/keyed_service/core/simple_dependency_manager.h"
#include "components/keyed_service/core/simple_factory_key.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_android.h"
#include "base/android/scoped_java_ref.h"
#include "chrome/browser/paint_preview/android/jni_headers/PaintPreviewTabServiceFactory_jni.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/profiles/profile_manager.h"
#endif
namespace paint_preview {
namespace {
constexpr char kFeatureDirname[] = …;
}
PaintPreviewTabServiceFactory* PaintPreviewTabServiceFactory::GetInstance() { … }
paint_preview::PaintPreviewTabService*
PaintPreviewTabServiceFactory::GetServiceInstance(SimpleFactoryKey* key) { … }
PaintPreviewTabServiceFactory::PaintPreviewTabServiceFactory()
: … { … }
PaintPreviewTabServiceFactory::~PaintPreviewTabServiceFactory() = default;
std::unique_ptr<KeyedService>
PaintPreviewTabServiceFactory::BuildServiceInstanceFor(
SimpleFactoryKey* key) const { … }
SimpleFactoryKey* PaintPreviewTabServiceFactory::GetKeyToUse(
SimpleFactoryKey* key) const { … }
#if BUILDFLAG(IS_ANDROID)
base::android::ScopedJavaLocalRef<jobject>
JNI_PaintPreviewTabServiceFactory_GetServiceInstanceForCurrentProfile(
JNIEnv* env) {
ProfileKey* profile_key =
ProfileManager::GetLastUsedProfile()->GetProfileKey();
base::android::ScopedJavaGlobalRef<jobject> java_ref =
PaintPreviewTabServiceFactory::GetServiceInstance(profile_key)
->GetJavaRef();
return base::android::ScopedJavaLocalRef<jobject>(java_ref);
}
#endif
}