root/chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateInfoBarDelegate.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. create
  2. changeTranslateInfoBarTypeAndPointer
  3. showTranslateInfoBar
  4. applyTranslateOptions
  5. nativeApplyTranslateOptions

// Copyright 2013 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.

package org.chromium.chrome.browser.infobar;

import org.chromium.base.CalledByNative;

/**
 * Translate JNI methods
 */
public class TranslateInfoBarDelegate {
    private TranslateInfoBar mInfoBar;

    private TranslateInfoBarDelegate() {}

    @CalledByNative
    public static TranslateInfoBarDelegate create() {
        return new TranslateInfoBarDelegate();
    }

    @CalledByNative
    boolean changeTranslateInfoBarTypeAndPointer(
            long newNativeInfoBar, int translateBarType, int new_target_language) {
        mInfoBar.changeInfoBarTypeAndNativePointer(
                translateBarType, new_target_language, newNativeInfoBar);
        return true;
    }

    @CalledByNative
    InfoBar showTranslateInfoBar(
            long nativeInfoBar, int translateBarType,
            int sourceLanguageIndex, int targetLanguageIndex, boolean autoTranslatePair,
            boolean showNeverInfobar, boolean triggeredFromMenu,
            String[] languages) {
        mInfoBar = new TranslateInfoBar(nativeInfoBar, this, translateBarType,
                sourceLanguageIndex, targetLanguageIndex, autoTranslatePair, showNeverInfobar,
                triggeredFromMenu, languages);
        return mInfoBar;
    }

    public void applyTranslateOptions(long nativeTranslateInfoBar,
            int sourceLanguageIndex, int targetLanguageIndex, boolean alwaysTranslate,
            boolean neverTranslateLanguage, boolean neverTranslateSite) {
        nativeApplyTranslateOptions(nativeTranslateInfoBar, sourceLanguageIndex,
                targetLanguageIndex, alwaysTranslate, neverTranslateLanguage, neverTranslateSite);
    }

    private native void nativeApplyTranslateOptions(long nativeTranslateInfoBar,
            int sourceLanguageIndex, int targetLanguageIndex, boolean alwaysTranslate,
            boolean neverTranslateLanguage, boolean neverTranslateSite);
}

/* [<][>][^][v][top][bottom][index][help] */