OLD | NEW |
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/views/passwords/account_chooser_dialog_view.h" | 5 #include "chrome/browser/ui/views/passwords/account_chooser_dialog_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
10 #include "chrome/browser/ui/passwords/password_dialog_controller.h" | 10 #include "chrome/browser/ui/passwords/password_dialog_controller.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 list_view->SetLayoutManager( | 74 list_view->SetLayoutManager( |
75 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 75 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
76 int item_height = 0; | 76 int item_height = 0; |
77 for (const auto& form : forms) { | 77 for (const auto& form : forms) { |
78 std::pair<base::string16, base::string16> titles = | 78 std::pair<base::string16, base::string16> titles = |
79 GetCredentialLabelsForAccountChooser(*form); | 79 GetCredentialLabelsForAccountChooser(*form); |
80 CredentialsItemView* credential_view = new CredentialsItemView( | 80 CredentialsItemView* credential_view = new CredentialsItemView( |
81 button_listener, titles.first, titles.second, kButtonHoverColor, | 81 button_listener, titles.first, titles.second, kButtonHoverColor, |
82 form.get(), request_context); | 82 form.get(), request_context); |
83 credential_view->SetLowerLabelColor(kAutoSigninTextColor); | 83 credential_view->SetLowerLabelColor(kAutoSigninTextColor); |
84 credential_view->SetBorder(views::Border::CreateEmptyBorder( | 84 credential_view->SetBorder(views::CreateEmptyBorder( |
85 kVerticalAvatarMargin, views::kButtonHEdgeMarginNew, | 85 kVerticalAvatarMargin, views::kButtonHEdgeMarginNew, |
86 kVerticalAvatarMargin, views::kButtonHEdgeMarginNew)); | 86 kVerticalAvatarMargin, views::kButtonHEdgeMarginNew)); |
87 item_height = std::max(item_height, credential_view->GetPreferredHeight()); | 87 item_height = std::max(item_height, credential_view->GetPreferredHeight()); |
88 list_view->AddChildView(credential_view); | 88 list_view->AddChildView(credential_view); |
89 } | 89 } |
90 views::ScrollView* scroll_view = new views::ScrollView; | 90 views::ScrollView* scroll_view = new views::ScrollView; |
91 scroll_view->ClipHeightTo(0, kMaxHeightAccounts * item_height); | 91 scroll_view->ClipHeightTo(0, kMaxHeightAccounts * item_height); |
92 scroll_view->SetContents(list_view); | 92 scroll_view->SetContents(list_view); |
93 return scroll_view; | 93 return scroll_view; |
94 } | 94 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 GetProfileFromWebContents(web_contents_)->GetRequestContext())); | 217 GetProfileFromWebContents(web_contents_)->GetRequestContext())); |
218 // DialogClientView adds kRelatedControlVerticalSpacing padding once more for | 218 // DialogClientView adds kRelatedControlVerticalSpacing padding once more for |
219 // the buttons. | 219 // the buttons. |
220 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 220 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
221 } | 221 } |
222 | 222 |
223 AccountChooserPrompt* CreateAccountChooserPromptView( | 223 AccountChooserPrompt* CreateAccountChooserPromptView( |
224 PasswordDialogController* controller, content::WebContents* web_contents) { | 224 PasswordDialogController* controller, content::WebContents* web_contents) { |
225 return new AccountChooserDialogView(controller, web_contents); | 225 return new AccountChooserDialogView(controller, web_contents); |
226 } | 226 } |
OLD | NEW |