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

Unified Diff: components/autofill/content/browser/wallet/wallet_service_url.cc

Issue 123363002: rAc: don't open sign in continue url in new tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests Created 6 years, 12 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: components/autofill/content/browser/wallet/wallet_service_url.cc
diff --git a/components/autofill/content/browser/wallet/wallet_service_url.cc b/components/autofill/content/browser/wallet/wallet_service_url.cc
index c5397635cdb1328564dc7b4029ab3e14278c88ee..88ac169239c639a878aeaa9293cb2a053c8f24f2 100644
--- a/components/autofill/content/browser/wallet/wallet_service_url.cc
+++ b/components/autofill/content/browser/wallet/wallet_service_url.cc
@@ -12,6 +12,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "components/autofill/core/common/autofill_switches.h"
+#include "content/public/common/url_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
@@ -29,6 +30,9 @@ const char kSandboxWalletServiceUrl[] =
const char kSandboxWalletSecureServiceUrl[] =
"https://wallet-web.sandbox.google.com/";
+// Set to true during some tests.
+bool g_use_testing_sign_in_continue_url = false;
+
bool IsWalletProductionEnabled() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
std::string sandbox_enabled(
@@ -150,12 +154,19 @@ GURL GetSignInUrl() {
// important what the URL actually is: it's not important that this URL has the
// ability to generate a gdToken.
GURL GetSignInContinueUrl() {
+ if (g_use_testing_sign_in_continue_url)
+ return GURL(content::kAboutBlankURL);
+
return GetPassiveAuthUrl(0);
}
+void SetUseTestingSignInContinueUrl() {
+ g_use_testing_sign_in_continue_url = true;
+}
+
bool IsSignInContinueUrl(const GURL& url, size_t* user_index) {
- GURL final_url = wallet::GetSignInContinueUrl();
- if (!url.SchemeIsSecure() ||
+ GURL final_url = GetSignInContinueUrl();
+ if (url.scheme() != final_url.scheme() ||
url.host() != final_url.host() ||
url.path() != final_url.path()) {
return false;
@@ -179,7 +190,9 @@ bool IsSignInContinueUrl(const GURL& url, size_t* user_index) {
}
bool IsSignInRelatedUrl(const GURL& url) {
- return url.GetOrigin() == GetSignInUrl().GetOrigin();
+ size_t unused;
+ return url.GetOrigin() == GetSignInUrl().GetOrigin() ||
+ IsSignInContinueUrl(url, &unused);
groby-ooo-7-16 2014/01/03 00:10:22 I assume we added this additional test because of
Evan Stade 2014/01/03 00:14:57 Not sure where you're getting the youtube idea fro
}
bool IsUsingProd() {

Powered by Google App Engine
This is Rietveld 408576698