| 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/passwords/manage_passwords_bubble_model.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 result.reserve(forms.size()); | 56 result.reserve(forms.size()); |
| 57 std::transform(forms.begin(), forms.end(), std::back_inserter(result), | 57 std::transform(forms.begin(), forms.end(), std::back_inserter(result), |
| 58 [](const std::unique_ptr<autofill::PasswordForm>& form) { | 58 [](const std::unique_ptr<autofill::PasswordForm>& form) { |
| 59 return *form; | 59 return *form; |
| 60 }); | 60 }); |
| 61 return result; | 61 return result; |
| 62 } | 62 } |
| 63 | 63 |
| 64 password_bubble_experiment::SmartLockBranding GetSmartLockBrandingState( | 64 password_bubble_experiment::SmartLockBranding GetSmartLockBrandingState( |
| 65 Profile* profile) { | 65 Profile* profile) { |
| 66 const ProfileSyncService* sync_service = | 66 const browser_sync::ProfileSyncService* sync_service = |
| 67 ProfileSyncServiceFactory::GetForProfile(profile); | 67 ProfileSyncServiceFactory::GetForProfile(profile); |
| 68 return password_bubble_experiment::GetSmartLockBrandingState(sync_service); | 68 return password_bubble_experiment::GetSmartLockBrandingState(sync_service); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 // Class responsible for collecting and reporting all the runtime interactions | 73 // Class responsible for collecting and reporting all the runtime interactions |
| 74 // with the bubble. | 74 // with the bubble. |
| 75 class ManagePasswordsBubbleModel::InteractionKeeper { | 75 class ManagePasswordsBubbleModel::InteractionKeeper { |
| 76 public: | 76 public: |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 PrefService* prefs = profile->GetPrefs(); | 429 PrefService* prefs = profile->GetPrefs(); |
| 430 return !prefs->GetBoolean( | 430 return !prefs->GetBoolean( |
| 431 password_manager::prefs::kWasSavePrompFirstRunExperienceShown); | 431 password_manager::prefs::kWasSavePrompFirstRunExperienceShown); |
| 432 } | 432 } |
| 433 return false; | 433 return false; |
| 434 } | 434 } |
| 435 | 435 |
| 436 bool ManagePasswordsBubbleModel::ReplaceToShowSignInPromoIfNeeded() { | 436 bool ManagePasswordsBubbleModel::ReplaceToShowSignInPromoIfNeeded() { |
| 437 DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); | 437 DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_); |
| 438 PrefService* prefs = GetProfile()->GetPrefs(); | 438 PrefService* prefs = GetProfile()->GetPrefs(); |
| 439 const ProfileSyncService* sync_service = | 439 const browser_sync::ProfileSyncService* sync_service = |
| 440 ProfileSyncServiceFactory::GetForProfile(GetProfile()); | 440 ProfileSyncServiceFactory::GetForProfile(GetProfile()); |
| 441 if (password_bubble_experiment::ShouldShowChromeSignInPasswordPromo( | 441 if (password_bubble_experiment::ShouldShowChromeSignInPasswordPromo( |
| 442 prefs, sync_service)) { | 442 prefs, sync_service)) { |
| 443 interaction_keeper_->ReportInteractions(this); | 443 interaction_keeper_->ReportInteractions(this); |
| 444 title_brand_link_range_ = gfx::Range(); | 444 title_brand_link_range_ = gfx::Range(); |
| 445 title_ = l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SIGNIN_PROMO_TITLE); | 445 title_ = l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SIGNIN_PROMO_TITLE); |
| 446 state_ = password_manager::ui::CHROME_SIGN_IN_PROMO_STATE; | 446 state_ = password_manager::ui::CHROME_SIGN_IN_PROMO_STATE; |
| 447 int show_count = prefs->GetInteger( | 447 int show_count = prefs->GetInteger( |
| 448 password_manager::prefs::kNumberSignInPasswordPromoShown); | 448 password_manager::prefs::kNumberSignInPasswordPromoShown); |
| 449 prefs->SetInteger(password_manager::prefs::kNumberSignInPasswordPromoShown, | 449 prefs->SetInteger(password_manager::prefs::kNumberSignInPasswordPromoShown, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 return metrics_util::NO_UPDATE_SUBMISSION; | 501 return metrics_util::NO_UPDATE_SUBMISSION; |
| 502 } | 502 } |
| 503 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) | 503 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) |
| 504 return metrics_util::NO_UPDATE_SUBMISSION; | 504 return metrics_util::NO_UPDATE_SUBMISSION; |
| 505 if (password_overridden_) | 505 if (password_overridden_) |
| 506 return update_events[3][behavior]; | 506 return update_events[3][behavior]; |
| 507 if (ShouldShowMultipleAccountUpdateUI()) | 507 if (ShouldShowMultipleAccountUpdateUI()) |
| 508 return update_events[2][behavior]; | 508 return update_events[2][behavior]; |
| 509 return update_events[1][behavior]; | 509 return update_events[1][behavior]; |
| 510 } | 510 } |
| OLD | NEW |