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

Unified Diff: chrome/browser/password_manager/generated_password_saved_infobar_delegate_android.cc

Issue 2588323002: Revert "Remove Finch support for PasswordBranding" (Closed)
Patch Set: Created 4 years 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/password_manager/generated_password_saved_infobar_delegate_android.cc
diff --git a/chrome/browser/password_manager/generated_password_saved_infobar_delegate_android.cc b/chrome/browser/password_manager/generated_password_saved_infobar_delegate_android.cc
index 1076c3f68ba818226f7ce7eb782685ab35677790..59ec915ea3f2159feae94a183de4ac6912df58f2 100644
--- a/chrome/browser/password_manager/generated_password_saved_infobar_delegate_android.cc
+++ b/chrome/browser/password_manager/generated_password_saved_infobar_delegate_android.cc
@@ -8,29 +8,56 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/android/chrome_application.h"
+#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
-#include "components/infobars/core/infobar_delegate.h"
+#include "components/browser_sync/profile_sync_service.h"
#include "components/password_manager/core/browser/password_bubble_experiment.h"
#include "components/password_manager/core/browser/password_manager_constants.h"
#include "components/strings/grit/components_strings.h"
+#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
GeneratedPasswordSavedInfoBarDelegateAndroid::
~GeneratedPasswordSavedInfoBarDelegateAndroid() {}
void GeneratedPasswordSavedInfoBarDelegateAndroid::OnInlineLinkClicked() {
- chrome::android::ChromeApplication::ShowPasswordSettings();
+ if (smart_lock_branding_enabled_) {
+ InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
+ content::OpenURLParams(
+ GURL(password_manager::kPasswordManagerAccountDashboardURL),
+ content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ ui::PAGE_TRANSITION_LINK, false));
+ } else {
+ chrome::android::ChromeApplication::ShowPasswordSettings();
+ }
}
GeneratedPasswordSavedInfoBarDelegateAndroid::
- GeneratedPasswordSavedInfoBarDelegateAndroid()
- : button_label_(l10n_util::GetStringUTF16(IDS_OK)) {
- base::string16 link = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
+ GeneratedPasswordSavedInfoBarDelegateAndroid(
+ content::WebContents *web_contents)
+ : button_label_(l10n_util::GetStringUTF16(IDS_OK)),
+ web_contents_(web_contents),
+ smart_lock_branding_enabled_(
+ password_bubble_experiment::IsSmartLockBrandingEnabled(
+ ProfileSyncServiceFactory::GetForProfile(
+ Profile::FromBrowserContext(
+ web_contents->GetBrowserContext())))) {
+ base::string16 link = l10n_util::GetStringUTF16(
+ IDS_MANAGE_PASSWORDS_LINK);
+ int confirmation_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR;
+ if (smart_lock_branding_enabled_) {
+ std::string management_hostname =
+ GURL(password_manager::kPasswordManagerAccountDashboardURL).host();
+ link = base::UTF8ToUTF16(management_hostname);
+ confirmation_id =
+ IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_SMART_LOCK_TEXT_INFOBAR;
+ }
- size_t offset = 0;
- message_text_ = l10n_util::GetStringFUTF16(
- IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR, link, &offset);
+ size_t offset;
+ message_text_ = l10n_util::GetStringFUTF16(confirmation_id, link, &offset);
inline_link_range_ = gfx::Range(offset, offset + link.length());
}

Powered by Google App Engine
This is Rietveld 408576698