Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/ui/android/infobars/update_password_infobar.cc

Issue 2256653002: Change password update infobar design according to current mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused variables Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/password_manager/update_password_infobar_delegate_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/android/infobars/update_password_infobar.h" 5 #include "chrome/browser/ui/android/infobars/update_password_infobar.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 18 matching lines...) Expand all
29 base::android::ScopedJavaLocalRef<jobject> 29 base::android::ScopedJavaLocalRef<jobject>
30 UpdatePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { 30 UpdatePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) {
31 using base::android::ConvertUTF16ToJavaString; 31 using base::android::ConvertUTF16ToJavaString;
32 using base::android::ScopedJavaLocalRef; 32 using base::android::ScopedJavaLocalRef;
33 UpdatePasswordInfoBarDelegate* update_password_delegate = 33 UpdatePasswordInfoBarDelegate* update_password_delegate =
34 static_cast<UpdatePasswordInfoBarDelegate*>(delegate()); 34 static_cast<UpdatePasswordInfoBarDelegate*>(delegate());
35 ScopedJavaLocalRef<jstring> ok_button_text = ConvertUTF16ToJavaString( 35 ScopedJavaLocalRef<jstring> ok_button_text = ConvertUTF16ToJavaString(
36 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); 36 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
37 ScopedJavaLocalRef<jstring> cancel_button_text = ConvertUTF16ToJavaString( 37 ScopedJavaLocalRef<jstring> cancel_button_text = ConvertUTF16ToJavaString(
38 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); 38 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL));
39 ScopedJavaLocalRef<jstring> branding_text = 39 ScopedJavaLocalRef<jstring> message_text =
40 ConvertUTF16ToJavaString(env, update_password_delegate->GetBranding()); 40 ConvertUTF16ToJavaString(env, update_password_delegate->GetMessageText());
41 41
42 std::vector<base::string16> usernames; 42 std::vector<base::string16> usernames;
43 if (update_password_delegate->ShowMultipleAccounts()) { 43 if (update_password_delegate->ShowMultipleAccounts()) {
44 for (auto* password_form : update_password_delegate->GetCurrentForms()) 44 for (auto* password_form : update_password_delegate->GetCurrentForms())
45 usernames.push_back(password_form->username_value); 45 usernames.push_back(password_form->username_value);
46 } else { 46 } else {
47 usernames.push_back( 47 usernames.push_back(
48 update_password_delegate->get_username_for_single_account()); 48 update_password_delegate->get_username_for_single_account());
49 } 49 }
50 50
51 base::android::ScopedJavaLocalRef<jobject> infobar; 51 base::android::ScopedJavaLocalRef<jobject> infobar;
52 infobar.Reset(Java_UpdatePasswordInfoBar_show( 52 infobar.Reset(Java_UpdatePasswordInfoBar_show(
53 env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(), 53 env, GetEnumeratedIconId(),
54 base::android::ToJavaArrayOfStrings(env, usernames), ok_button_text, 54 base::android::ToJavaArrayOfStrings(env, usernames), message_text,
55 cancel_button_text, branding_text, 55 update_password_delegate->message_link_range().start(),
56 update_password_delegate->ShowMultipleAccounts(), 56 update_password_delegate->message_link_range().end(), ok_button_text,
57 update_password_delegate->is_smartlock_branding_enabled())); 57 cancel_button_text));
58 58
59 java_infobar_.Reset(env, infobar.obj()); 59 java_infobar_.Reset(env, infobar.obj());
60 return infobar; 60 return infobar;
61 } 61 }
62 62
63 void UpdatePasswordInfoBar::OnLinkClicked(JNIEnv* env, 63 void UpdatePasswordInfoBar::OnLinkClicked(JNIEnv* env,
64 const JavaParamRef<jobject>& obj) { 64 const JavaParamRef<jobject>& obj) {
65 GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB); 65 GetDelegate()->LinkClicked(NEW_FOREGROUND_TAB);
66 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/update_password_infobar_delegate_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698