From b5382e56e7748de30b5fbdfb0dab168d725a6cdd Mon Sep 17 00:00:00 2001 From: "jwd@chromium.org" Date: Tue, 9 Apr 2013 22:18:43 +0000 Subject: [PATCH] Correctly logging One-click shown and dismissed actions. BUG=228976 Review URL: https://chromiumcodereview.appspot.com/13686017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193233 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/ui/sync/one_click_signin_helper.cc | 12 ++++++++++-- chrome/browser/ui/sync/one_click_signin_helper.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index 9338e96441cd..085a8a74ea15 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -373,6 +373,8 @@ ConfirmEmailDialogDelegate::ConfirmEmailDialogDelegate( // Tells when we are in the process of showing either the signin to chrome page // or the one click sign in to chrome page. +// NOTE: This should only be used for logging purposes since it relies on hard +// coded URLs that could change. bool AreWeShowingSignin(GURL url, SyncPromoUI::Source source, std::string email) { GURL::Replacements replacements; @@ -381,8 +383,14 @@ bool AreWeShowingSignin(GURL url, SyncPromoUI::Source source, GURL(GaiaUrls::GetInstance()->service_login_url()).ReplaceComponents( replacements); + GURL clean_one_click_url = + GURL(GaiaUrls::GetInstance()->gaia_login_form_realm() + + "ChromeLoginPrompt").ReplaceComponents(replacements); + return (url.ReplaceComponents(replacements) == clean_login_url && - source != SyncPromoUI::SOURCE_UNKNOWN) || !email.empty(); + source != SyncPromoUI::SOURCE_UNKNOWN) || + (url.ReplaceComponents(replacements) == clean_one_click_url && + !email.empty()); } } // namespace @@ -1189,7 +1197,7 @@ void OneClickSigninHelper::DidStopLoading( switch (auto_accept_) { case AUTO_ACCEPT_NONE: - if (SyncPromoUI::UseWebBasedSigninFlow()) { + if (SyncPromoUI::UseWebBasedSigninFlow() && showing_signin_) { LogOneClickHistogramValue(one_click_signin::HISTOGRAM_DISMISSED); } else { OneClickInfoBarDelegateImpl::Create( diff --git a/chrome/browser/ui/sync/one_click_signin_helper.h b/chrome/browser/ui/sync/one_click_signin_helper.h index f9ff9a3a8da1..398b46c7b582 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.h +++ b/chrome/browser/ui/sync/one_click_signin_helper.h @@ -206,6 +206,7 @@ class OneClickSigninHelper // Tracks if we are in the process of showing the signin or one click // interstitial page. It's set to true the first time we load one of those // pages and set to false when transient state is cleaned. + // Note: This should only be used for logging purposes. bool showing_signin_; // Information about the account that has just logged in. -- 2.11.4.GIT