// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file is autogenerated by
//     base/android/jni_generator/jni_generator.py
// For
//     org/chromium/base/ContextTypes

#ifndef org_chromium_base_ContextTypes_JNI
#define org_chromium_base_ContextTypes_JNI

#include <jni.h>
#include "base/android/jni_generator/jni_generator_helper.h"

// Step 1: forward declarations.
namespace {
const char kContextTypesClassPath[] = "org/chromium/base/ContextTypes";
// Leaking this jclass as we cannot use LazyInstance from some threads.
jclass g_ContextTypes_clazz = NULL;

}  // namespace

// Step 2: method stubs.

static base::subtle::AtomicWord g_ContextTypes_isRunningInWebapp = 0;
static jboolean Java_ContextTypes_isRunningInWebapp(JNIEnv* env, jobject
    appContext) {
  /* Must call RegisterNativesImpl()  */
  CHECK_CLAZZ(env, g_ContextTypes_clazz,
      g_ContextTypes_clazz, false);
  jmethodID method_id =
      base::android::MethodID::LazyGet<
      base::android::MethodID::TYPE_STATIC>(
      env, g_ContextTypes_clazz,
      "isRunningInWebapp",

"("
"Landroid/content/Context;"
")"
"Z",
      &g_ContextTypes_isRunningInWebapp);

  jboolean ret =
      env->CallStaticBooleanMethod(g_ContextTypes_clazz,
          method_id, appContext);
  jni_generator::CheckException(env);
  return ret;
}

// Step 3: RegisterNatives.

static bool RegisterNativesImpl(JNIEnv* env) {
  g_ContextTypes_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
      base::android::GetClass(env, kContextTypesClassPath).obj()));

  return true;
}

#endif  // org_chromium_base_ContextTypes_JNI
