blob: 1cdda87d29fbdb7326405186cb91ead51093e6d9 [file] [log] [blame]
Nicolas Dossou-Gbeteb6d251832024-08-20 18:14:031// Copyright 2024 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <iterator>
6#include <string>
7
8#include "base/android/feature_map.h"
9#include "base/feature_list.h"
10#include "base/features.h"
11#include "base/no_destructor.h"
12#include "components/search_engines/search_engines_switches.h"
13
14// Must come after all headers that specialize FromJniType() / ToJniType().
15#include "components/search_engines/android/features_jni_headers/SearchEnginesFeatureMap_jni.h"
16
17namespace search_engines {
18
19namespace {
20
21// Array of features exposed through the Java BaseFeatureMap API. Entries in
22// this array refer to features defined in //search_engines features.
23const base::Feature* const kFeaturesExposedToJava[] = {
Tanmoy Mollik6cb9bca2024-11-04 13:49:1524 &switches::kClayBlocking, &switches::kClayBackendConnectionV2,
25 &switches::kClaySnackbar};
Nicolas Dossou-Gbeteb6d251832024-08-20 18:14:0326
27// static
28base::android::FeatureMap* GetFeatureMap() {
29 static base::NoDestructor<base::android::FeatureMap> kFeatureMap(std::vector(
30 std::begin(kFeaturesExposedToJava), std::end(kFeaturesExposedToJava)));
31 return kFeatureMap.get();
32}
33
34} // namespace
35
36static jlong JNI_SearchEnginesFeatureMap_GetNativeMap(JNIEnv* env) {
37 return reinterpret_cast<jlong>(GetFeatureMap());
38}
39
40} // namespace search_engines