chromium/chrome/browser/paint_preview/services/paint_preview_tab_service_factory.cc

// Copyright 2020 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/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  // BUILDFLAG(IS_ANDROID)

namespace paint_preview {

namespace {

constexpr char kFeatureDirname[] =;

}  // namespace

// static
PaintPreviewTabServiceFactory* PaintPreviewTabServiceFactory::GetInstance() {}

// static
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  // BUILDFLAG(IS_ANDROID)

}  // namespace paint_preview