OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #include "chrome/browser/ui/android/snackbars/auto_signin_snackbar_controller.h" |
| 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/android/tab_android.h" |
| 10 #include "jni/AutoSigninSnackbarController_jni.h" |
| 11 |
| 12 AutoSigninSnackbarController::AutoSigninSnackbarController(TabAndroid *tab) { |
| 13 JNIEnv *env = base::android::AttachCurrentThread(); |
| 14 java_snackbar_controller_.Reset(Java_AutoSigninSnackbarController_create( |
| 15 env, tab->GetJavaObject().obj(), reinterpret_cast<intptr_t>(this))); |
| 16 } |
| 17 |
| 18 AutoSigninSnackbarController::~AutoSigninSnackbarController() {} |
| 19 |
| 20 void AutoSigninSnackbarController::onShow(const base::string16 &username) { |
| 21 JNIEnv *env = base::android::AttachCurrentThread(); |
| 22 Java_AutoSigninSnackbarController_show( |
| 23 env, java_snackbar_controller_.obj(), |
| 24 base::android::ConvertUTF16ToJavaString(env, username).obj()); |
| 25 } |
| 26 |
| 27 void AutoSigninSnackbarController::Destroy(JNIEnv *env, jobject obj) { |
| 28 delete this; |
| 29 } |
| 30 |
| 31 bool RegisterAutoSigninSnackbarController(JNIEnv *env) { |
| 32 return RegisterNativesImpl(env); |
| 33 } |
OLD | NEW |