Skip to content

Commit

Permalink
Updating target URL to open chrome://settings/password
Browse files Browse the repository at this point in the history
This change also allows redirect from a testing website.

(cherry picked from commit d6fe7e4)

Bug: 1329165
Change-Id: I80fa3a69675606e46069b006d27bc163cc5f9bf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3666723
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1007394}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3673522
Cr-Commit-Position: refs/branch-heads/5060@{#385}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Viktor Semeniuk authored and Chromium LUCI CQ committed May 30, 2022
1 parent 19eb57b commit 2422ba4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ bool IsTriggeredOnGoogleOwnedUI(NavigationHandle* handle) {
return false;

// Referrer origin and target URL must match.
if (handle->GetURL() != GURL(password_manager::kManageMyPasswordsURL))
return false;

url::Origin origin = handle->GetInitiatorOrigin().value_or(url::Origin());
if (origin != url::Origin::Create(GURL(password_manager::kReferrerURL)) ||
handle->GetURL() != GURL(password_manager::kManageMyPasswordsURL))
if (origin != url::Origin::Create(GURL(password_manager::kReferrerURL)) &&
origin !=
url::Origin::Create(GURL(password_manager::kTestingReferrerURL)))
return false;

#if BUILDFLAG(IS_ANDROID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,13 @@ TEST_F(PasswordManagerNavigationThrottleTest,
url::Origin::Create(GURL(password_manager::kReferrerURL)),
}));
}

TEST_F(PasswordManagerNavigationThrottleTest,
CreatesNavigationThrottleForTestingWebsite) {
EXPECT_TRUE(CreateNavigationThrottle({
.url = GURL(password_manager::kManageMyPasswordsURL),
.page_transition = ui::PAGE_TRANSITION_LINK,
.initiator_origin =
url::Origin::Create(GURL(password_manager::kTestingReferrerURL)),
}));
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ const char kPasswordManagerHelpCenteriOSURL[] =
const char kPasswordManagerHelpCenterSmartLock[] =
"https://support.google.com/accounts?p=smart_lock_chrome";

const char kManageMyPasswordsURL[] = "https://passwords.google.com/native";
const char kManageMyPasswordsURL[] = "https://passwords.google.com/app";

const char kReferrerURL[] = "https://passwords.google/";

const char kTestingReferrerURL[] =
"https://xl-password-manager-staging.uc.r.appspot.com/";

} // namespace password_manager
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ extern const char kManageMyPasswordsURL[];
// URL from which native Password Manager UI can be opened.
extern const char kReferrerURL[];

// URL for a testing website from which native Password Manager UI can be
// opened.
// TODO(crbug.com/1329165): remove when the main website is launched.
extern const char kTestingReferrerURL[];

} // namespace password_manager

#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CONSTANTS_H_

0 comments on commit 2422ba4

Please sign in to comment.