external_intents_features.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/external_intents/android/external_intents_features.h"
  5. #include <jni.h>
  6. #include <stddef.h>
  7. #include <string>
  8. #include "base/android/jni_string.h"
  9. #include "base/notreached.h"
  10. #include "components/external_intents/android/jni_headers/ExternalIntentsFeatures_jni.h"
  11. namespace external_intents {
  12. namespace {
  13. // Array of features exposed through the Java ExternalIntentsFeatures API.
  14. const base::Feature* kFeaturesExposedToJava[] = {
  15. &kAutofillAssistantGoogleInitiatorOriginCheck,
  16. &kScaryExternalNavigationRefactoring};
  17. } // namespace
  18. // Alphabetical:
  19. // Uses the initiator origin to check whether a navigation was started from a
  20. // Google domain.
  21. const base::Feature kAutofillAssistantGoogleInitiatorOriginCheck{
  22. "AutofillAssistantGoogleInitiatorOriginCheck",
  23. base::FEATURE_ENABLED_BY_DEFAULT};
  24. const base::Feature kScaryExternalNavigationRefactoring{
  25. "ScaryExternalNavigationRefactoring", base::FEATURE_ENABLED_BY_DEFAULT};
  26. static jlong JNI_ExternalIntentsFeatures_GetFeature(JNIEnv* env, jint ordinal) {
  27. return reinterpret_cast<jlong>(kFeaturesExposedToJava[ordinal]);
  28. }
  29. } // namespace external_intents