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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_view_utils.cc

Issue 2201413002: Show 3 rows in the account chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update a unit test Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/passwords/manage_passwords_view_utils.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 skia_image = gfx::ImageSkiaOperations::ExtractSubset(skia_image, target); 48 skia_image = gfx::ImageSkiaOperations::ExtractSubset(skia_image, target);
49 } 49 }
50 return gfx::ImageSkiaOperations::CreateResizedImage( 50 return gfx::ImageSkiaOperations::CreateResizedImage(
51 skia_image, 51 skia_image,
52 skia::ImageOperations::RESIZE_BEST, 52 skia::ImageOperations::RESIZE_BEST,
53 gfx::Size(kAvatarImageSize, kAvatarImageSize)); 53 gfx::Size(kAvatarImageSize, kAvatarImageSize));
54 } 54 }
55 55
56 std::pair<base::string16, base::string16> GetCredentialLabelsForAccountChooser( 56 std::pair<base::string16, base::string16> GetCredentialLabelsForAccountChooser(
57 const autofill::PasswordForm& form) { 57 const autofill::PasswordForm& form) {
58 const base::string16& upper_string = 58 base::string16 federation;
59 form.display_name.empty() ? form.username_value : form.display_name; 59 if (!form.federation_origin.unique()) {
60 base::string16 lower_string; 60 federation = l10n_util::GetStringFUTF16(
61 if (form.federation_origin.unique()) {
62 if (!form.display_name.empty())
63 lower_string = form.username_value;
64 } else {
65 lower_string = l10n_util::GetStringFUTF16(
66 IDS_PASSWORDS_VIA_FEDERATION, 61 IDS_PASSWORDS_VIA_FEDERATION,
67 base::UTF8ToUTF16(form.federation_origin.host())); 62 base::UTF8ToUTF16(form.federation_origin.host()));
68 } 63 }
69 return std::make_pair(upper_string, lower_string); 64
65 if (form.display_name.empty())
66 return std::make_pair(form.username_value, std::move(federation));
67
68 // Display name isn't empty.
69 if (federation.empty())
70 return std::make_pair(form.display_name, form.username_value);
71
72 return std::make_pair(
73 form.display_name,
74 form.username_value + base::ASCIIToUTF16("\n") + federation);
70 } 75 }
71 76
72 void GetSavePasswordDialogTitleTextAndLinkRange( 77 void GetSavePasswordDialogTitleTextAndLinkRange(
73 const GURL& user_visible_url, 78 const GURL& user_visible_url,
74 const GURL& form_origin_url, 79 const GURL& form_origin_url,
75 bool is_smartlock_branding_enabled, 80 bool is_smartlock_branding_enabled,
76 PasswordTittleType dialog_type, 81 PasswordTittleType dialog_type,
77 base::string16* title, 82 base::string16* title,
78 gfx::Range* title_link_range) { 83 gfx::Range* title_link_range) {
79 DCHECK(!password_manager::IsValidAndroidFacetURI(form_origin_url.spec())); 84 DCHECK(!password_manager::IsValidAndroidFacetURI(form_origin_url.spec()));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 : form.username_value; 182 : form.username_value;
178 } 183 }
179 184
180 bool IsSyncingAutosignSetting(Profile* profile) { 185 bool IsSyncingAutosignSetting(Profile* profile) {
181 const ProfileSyncService* sync_service = 186 const ProfileSyncService* sync_service =
182 ProfileSyncServiceFactory::GetForProfile(profile); 187 ProfileSyncServiceFactory::GetForProfile(profile);
183 return (sync_service && sync_service->IsFirstSetupComplete() && 188 return (sync_service && sync_service->IsFirstSetupComplete() &&
184 sync_service->IsSyncActive() && 189 sync_service->IsSyncActive() &&
185 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); 190 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES));
186 } 191 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_view_utils.h ('k') | chrome/browser/ui/views/passwords/credentials_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698