| 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 65e62f08b5d2b6a41cc8bd6111348399ea079f02..5d5a6b8d59d8f32b7ec697f875f0a1eb846b198c 100644
|
| --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
|
| +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
|
| @@ -61,10 +61,11 @@ std::vector<autofill::PasswordForm> DeepCopyForms(
|
| return result;
|
| }
|
|
|
| -bool IsSmartLockUser(Profile* profile) {
|
| +password_bubble_experiment::SmartLockBranding GetSmartLockBrandingState(
|
| + Profile* profile) {
|
| const browser_sync::ProfileSyncService* sync_service =
|
| ProfileSyncServiceFactory::GetForProfile(profile);
|
| - return password_bubble_experiment::IsSmartLockUser(sync_service);
|
| + return password_bubble_experiment::GetSmartLockBrandingState(sync_service);
|
| }
|
|
|
| } // namespace
|
| @@ -150,6 +151,11 @@ void ManagePasswordsBubbleModel::InteractionKeeper::ReportInteractions(
|
| if (model->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
|
| Profile* profile = model->GetProfile();
|
| if (profile) {
|
| + if (GetSmartLockBrandingState(profile) ==
|
| + password_bubble_experiment::SmartLockBranding::FULL) {
|
| + password_bubble_experiment::RecordSavePromptFirstRunExperienceWasShown(
|
| + profile->GetPrefs());
|
| + }
|
| if (dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION &&
|
| display_disposition_ ==
|
| metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING) {
|
| @@ -249,10 +255,20 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
|
| if (state_ == password_manager::ui::CONFIRMATION_STATE) {
|
| base::string16 save_confirmation_link =
|
| l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
|
| + int confirmation_text_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT;
|
| + if (GetSmartLockBrandingState(GetProfile()) ==
|
| + password_bubble_experiment::SmartLockBranding::FULL) {
|
| + std::string management_hostname =
|
| + GURL(password_manager::kPasswordManagerAccountDashboardURL).host();
|
| + save_confirmation_link = base::UTF8ToUTF16(management_hostname);
|
| + confirmation_text_id =
|
| + IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_SMART_LOCK_TEXT;
|
| + }
|
| +
|
| size_t offset;
|
| save_confirmation_text_ =
|
| - l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT,
|
| - save_confirmation_link, &offset);
|
| + l10n_util::GetStringFUTF16(
|
| + confirmation_text_id, save_confirmation_link, &offset);
|
| save_confirmation_link_range_ =
|
| gfx::Range(offset, offset + save_confirmation_link.length());
|
| }
|
| @@ -359,7 +375,12 @@ void ManagePasswordsBubbleModel::OnOKClicked() {
|
|
|
| void ManagePasswordsBubbleModel::OnManageLinkClicked() {
|
| interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_MANAGE);
|
| - delegate_->NavigateToPasswordManagerSettingsPage();
|
| + if (GetSmartLockBrandingState(GetProfile()) ==
|
| + password_bubble_experiment::SmartLockBranding::FULL) {
|
| + delegate_->NavigateToExternalPasswordManager();
|
| + } else {
|
| + delegate_->NavigateToPasswordManagerSettingsPage();
|
| + }
|
| }
|
|
|
| void ManagePasswordsBubbleModel::OnBrandLinkClicked() {
|
| @@ -416,6 +437,17 @@ bool ManagePasswordsBubbleModel::ShouldShowMultipleAccountUpdateUI() const {
|
| local_credentials_.size() > 1 && !password_overridden_;
|
| }
|
|
|
| +bool ManagePasswordsBubbleModel::ShouldShowGoogleSmartLockWelcome() const {
|
| + Profile* profile = GetProfile();
|
| + if (GetSmartLockBrandingState(profile) ==
|
| + password_bubble_experiment::SmartLockBranding::FULL) {
|
| + PrefService* prefs = profile->GetPrefs();
|
| + return !prefs->GetBoolean(
|
| + password_manager::prefs::kWasSavePrompFirstRunExperienceShown);
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool ManagePasswordsBubbleModel::ReplaceToShowSignInPromoIfNeeded() {
|
| DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
|
| PrefService* prefs = GetProfile()->GetPrefs();
|
| @@ -452,7 +484,9 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
|
| ? PasswordTitleType::SAVE_PASSWORD
|
| : PasswordTitleType::SAVE_ACCOUNT);
|
| GetSavePasswordDialogTitleTextAndLinkRange(
|
| - GetWebContents()->GetVisibleURL(), origin_, IsSmartLockUser(GetProfile()),
|
| + GetWebContents()->GetVisibleURL(), origin_,
|
| + GetSmartLockBrandingState(GetProfile()) !=
|
| + password_bubble_experiment::SmartLockBranding::NONE,
|
| type, &title_, &title_brand_link_range_);
|
| }
|
|
|
|
|