Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 1141413002: Prepare password_bubble_experiment and password_manager_util for componentisation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android 2 Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2b832256440aaea85e17d03f15de4b8d3e6f1dc8..1495ffce4a5a248a2e097897683fc3ef1d2d8a00 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -9,6 +9,8 @@
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
@@ -72,6 +74,14 @@ ScopedVector<const autofill::PasswordForm> DeepCopyForms(
return result.Pass();
}
+// A wrapper around password_bubble_experiment::IsSmartLockBrandingEnabled
+// extracting the sync_service from the profile.
+bool IsSmartLockBrandingEnabled(Profile* profile) {
+ const ProfileSyncService* sync_service =
+ ProfileSyncServiceFactory::GetForProfile(profile);
+ return password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service);
+}
+
} // namespace
ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
@@ -121,7 +131,7 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
base::string16 save_confirmation_link =
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
int confirmation_text_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT;
- if (password_bubble_experiment::IsSmartLockBrandingEnabled(GetProfile())) {
+ if (IsSmartLockBrandingEnabled(GetProfile())) {
std::string management_hostname =
GURL(chrome::kPasswordManagerAccountDashboardURL).host();
save_confirmation_link = base::UTF8ToUTF16(management_hostname);
@@ -249,7 +259,7 @@ void ManagePasswordsBubbleModel::OnOKClicked() {
void ManagePasswordsBubbleModel::OnManageLinkClicked() {
dismissal_reason_ = metrics_util::CLICKED_MANAGE;
- if (password_bubble_experiment::IsSmartLockBrandingEnabled(GetProfile())) {
+ if (IsSmartLockBrandingEnabled(GetProfile())) {
ManagePasswordsUIController::FromWebContents(web_contents())
->NavigateToExternalPasswordManager();
} else {
@@ -328,8 +338,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
if (never_save_passwords_) {
title_ = l10n_util::GetStringUTF16(
IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE);
- } else if (password_bubble_experiment::IsSmartLockBrandingEnabled(
- GetProfile())) {
+ } else if (IsSmartLockBrandingEnabled(GetProfile())) {
// "Google Smart Lock" should be a hyperlink.
base::string16 brand_link =
l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);

Powered by Google App Engine
This is Rietveld 408576698