Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 222 |
| 223 DISALLOW_COPY_AND_ASSIGN(AutoSigninView); | 223 DISALLOW_COPY_AND_ASSIGN(AutoSigninView); |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 ManagePasswordsBubbleView::AutoSigninView::AutoSigninView( | 226 ManagePasswordsBubbleView::AutoSigninView::AutoSigninView( |
| 227 ManagePasswordsBubbleView* parent) | 227 ManagePasswordsBubbleView* parent) |
| 228 : parent_(parent), | 228 : parent_(parent), |
| 229 observed_browser_(this) { | 229 observed_browser_(this) { |
| 230 SetLayoutManager(new views::FillLayout); | 230 SetLayoutManager(new views::FillLayout); |
| 231 const autofill::PasswordForm& form = parent_->model()->pending_password(); | 231 const autofill::PasswordForm& form = parent_->model()->pending_password(); |
| 232 CredentialsItemView* credential = new CredentialsItemView( | 232 CredentialsItemView* credential; |
| 233 this, base::string16(), | 233 if (ChromeLayoutProvider::Get()->IsHarmonyMode()) { |
| 234 l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, | 234 credential = new CredentialsItemView( |
| 235 form.username_value), | 235 this, |
| 236 kButtonHoverColor, &form, | 236 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE_MD), |
| 237 parent_->model()->GetProfile()->GetRequestContext()); | 237 form.username_value, kButtonHoverColor, &form, |
| 238 parent_->model()->GetProfile()->GetRequestContext()); | |
| 239 } else { | |
| 240 credential = new CredentialsItemView( | |
| 241 this, base::string16(), | |
| 242 l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE, | |
| 243 form.username_value), | |
| 244 kButtonHoverColor, &form, | |
| 245 parent_->model()->GetProfile()->GetRequestContext()); | |
| 246 } | |
|
Peter Kasting
2017/04/24 22:48:31
Nit: I'd like to avoid this code duplication. May
kylix_rd
2017/04/25 17:14:07
I like this solution. Thanks.
| |
| 238 credential->SetEnabled(false); | 247 credential->SetEnabled(false); |
| 239 AddChildView(credential); | 248 AddChildView(credential); |
| 240 | 249 |
| 241 // Setup the observer and maybe start the timer. | 250 // Setup the observer and maybe start the timer. |
| 242 Browser* browser = | 251 Browser* browser = |
| 243 chrome::FindBrowserWithWebContents(parent_->web_contents()); | 252 chrome::FindBrowserWithWebContents(parent_->web_contents()); |
| 244 DCHECK(browser); | 253 DCHECK(browser); |
| 245 | 254 |
| 246 // Sign-in dialogs opened for inactive browser windows do not auto-close on | 255 // Sign-in dialogs opened for inactive browser windows do not auto-close on |
| 247 // MacOS. This matches existing Cocoa bubble behavior. | 256 // MacOS. This matches existing Cocoa bubble behavior. |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 } else if (model_.state() == | 883 } else if (model_.state() == |
| 875 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 884 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 876 AddChildView(new DesktopIOSPromotionBubbleView( | 885 AddChildView(new DesktopIOSPromotionBubbleView( |
| 877 model_.GetProfile(), | 886 model_.GetProfile(), |
| 878 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 887 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
| 879 #endif | 888 #endif |
| 880 } else { | 889 } else { |
| 881 AddChildView(new ManageView(this)); | 890 AddChildView(new ManageView(this)); |
| 882 } | 891 } |
| 883 } | 892 } |
| OLD | NEW |