Chromium Code Reviews| Index: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| index 8fc9f4c871bbe9fe6e373bfda1e6a8b3c92d2b28..bec5d43f9fa1f3ed6c5de5d638fcda74609f0064 100644 |
| --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| @@ -4,6 +4,8 @@ |
| #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| +#include "base/command_line.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/password_manager/password_store_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/browser.h" |
| @@ -17,6 +19,7 @@ |
| #include "components/password_manager/core/browser/password_store.h" |
| #include "components/password_manager/core/common/password_manager_ui.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/common/content_switches.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/resource/resource_bundle.h" |
| @@ -111,7 +114,12 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( |
| } else if (state_ == password_manager::ui::AUTO_SIGNIN_STATE) { |
| // There is no title. |
| } else { |
| - title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); |
| + if (IsNewUIActive()) { |
|
Mike West
2015/03/18 08:33:51
Optional nit: I'd vaguely prefer `title_ = IsNewUI
vasilii
2015/03/18 09:25:08
Done.
|
| + title_ = l10n_util::GetStringFUTF16(IDS_MANAGE_ACCOUNTS_TITLE, |
| + base::UTF8ToUTF16(origin_.spec())); |
| + } else { |
| + title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); |
| + } |
| } |
| if (state_ == password_manager::ui::CONFIRMATION_STATE) { |
| @@ -245,6 +253,14 @@ void ManagePasswordsBubbleModel::OnAutoSignInToastTimeout() { |
| dismissal_reason_ = metrics_util::AUTO_SIGNIN_TOAST_TIMEOUT; |
| } |
| +void ManagePasswordsBubbleModel::OnAutoSignInClicked() { |
| + dismissal_reason_ = metrics_util::AUTO_SIGNIN_TOAST_CLICKED; |
| + ManagePasswordsUIController* manage_passwords_ui_controller = |
| + ManagePasswordsUIController::FromWebContents(web_contents()); |
| + manage_passwords_ui_controller->ManageAccounts(); |
| + state_ = password_manager::ui::MANAGE_STATE; |
| +} |
| + |
| void ManagePasswordsBubbleModel::OnPasswordAction( |
| const autofill::PasswordForm& password_form, |
| PasswordAction action) { |
| @@ -278,6 +294,11 @@ Profile* ManagePasswordsBubbleModel::GetProfile() const { |
| return GetProfileFromWebContents(web_contents()); |
| } |
| +bool ManagePasswordsBubbleModel::IsNewUIActive() const { |
| + return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableCredentialManagerAPI); |
| +} |
| + |
| // static |
| int ManagePasswordsBubbleModel::UsernameFieldWidth() { |
| return GetFieldWidth(USERNAME_FIELD); |