Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / password_manager / credential_android.cc
blob291102b2835b8cfc81babb3734705b095f0b00c3
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.
5 #include "chrome/browser/password_manager/credential_android.h"
7 #include "base/android/jni_string.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/grit/generated_resources.h"
10 #include "jni/Credential_jni.h"
11 #include "ui/base/l10n/l10n_util.h"
13 base::android::ScopedJavaLocalRef<jobject> CreateNativeCredential(
14 JNIEnv* env,
15 const autofill::PasswordForm& password_form,
16 int position,
17 int type) {
18 using base::android::ConvertUTF16ToJavaString;
19 using base::android::ConvertUTF8ToJavaString;
20 std::string federation =
21 password_form.federation_url.is_empty()
22 ? ""
23 : l10n_util::GetStringFUTF8(
24 IDS_MANAGE_PASSWORDS_IDENTITY_PROVIDER,
25 base::ASCIIToUTF16(password_form.federation_url.host()));
26 return Java_Credential_createCredential(
27 env, ConvertUTF16ToJavaString(env, password_form.username_value).obj(),
28 ConvertUTF16ToJavaString(env, password_form.display_name).obj(),
29 ConvertUTF8ToJavaString(env, federation).obj(), type, position);
32 base::android::ScopedJavaLocalRef<jobjectArray> CreateNativeCredentialArray(
33 JNIEnv* env,
34 size_t size) {
35 return Java_Credential_createCredentialArray(env, static_cast<int>(size));
38 bool RegisterCredential(JNIEnv* env) {
39 return RegisterNativesImpl(env);