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

Unified Diff: chrome/browser/signin/signin_header_helper.cc

Issue 288493008: UMA Metrics for the user menu, including vasquette-detection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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
« no previous file with comments | « chrome/browser/signin/signin_header_helper.h ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/signin_header_helper.cc
diff --git a/chrome/browser/signin/signin_header_helper.cc b/chrome/browser/signin/signin_header_helper.cc
index 96f1a65360e9e987ef480a20e8a5cd0943920e39..8b958a0a583c3af7a97764c660858548b63663ce 100644
--- a/chrome/browser/signin/signin_header_helper.cc
+++ b/chrome/browser/signin/signin_header_helper.cc
@@ -30,11 +30,27 @@ namespace {
const char kChromeConnectedHeader[] = "X-Chrome-Connected";
const char kChromeManageAccountsHeader[] = "X-Chrome-Manage-Accounts";
-const char kGaiaSignoutOptionsIncognito[] = "SIGNOUTOPTIONS_INCOGNITO";
const char kGaiaIdAttrName[] = "id";
const char kProfileModeAttrName[] = "mode";
const char kEnableAccountConsistencyAttrName[] = "enable_account_consistency";
+// Determine the service type that has been passed from GAIA in the header.
+signin::GAIAServiceType GetGAIAServiceTypeFromHeader(
+ const std::string& header_value) {
+ if (header_value == "SIGNOUT")
+ return signin::GAIA_SERVICE_TYPE_SIGNOUT;
+ else if (header_value == "SIGNOUTOPTIONS_INCOGNITO")
+ return signin::GAIA_SERVICE_TYPE_SIGNOUTOPTIONS_INCOGNITO;
+ else if (header_value == "ADDSESSION")
+ return signin::GAIA_SERVICE_TYPE_ADDSESSION;
+ else if (header_value == "REAUTH")
+ return signin::GAIA_SERVICE_TYPE_REAUTH;
+ else if (header_value == "DEFAULT")
+ return signin::GAIA_SERVICE_TYPE_DEFAULT;
+ else
+ return signin::GAIA_SERVICE_TYPE_NONE;
+}
+
// Processes the mirror response header on the UI thread. Currently depending
// on the value of |header_value|, it either shows the profile avatar menu, or
// opens an incognito window/tab.
@@ -47,22 +63,28 @@ void ProcessMirrorHeaderUIThread(
if (!web_contents)
return;
+ signin::GAIAServiceType service_type =
+ GetGAIAServiceTypeFromHeader(header_value);
+
#if !defined(OS_ANDROID)
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
if (browser) {
- if (header_value == kGaiaSignoutOptionsIncognito) {
+ if (service_type == signin::GAIA_SERVICE_TYPE_SIGNOUTOPTIONS_INCOGNITO) {
chrome::NewIncognitoWindow(browser);
} else {
browser->window()->ShowAvatarBubbleFromAvatarButton(
- BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT);
+ BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
+ service_type);
}
}
#else // defined(OS_ANDROID)
- if (header_value == kGaiaSignoutOptionsIncognito) {
+ if (service_type == signin::GAIA_SERVICE_TYPE_SIGNOUTOPTIONS_INCOGNITO) {
web_contents->OpenURL(content::OpenURLParams(
GURL(chrome::kChromeUINativeNewTabURL), content::Referrer(),
OFF_THE_RECORD, content::PAGE_TRANSITION_AUTO_TOPLEVEL, false));
} else {
+ // TODO(mlerman): pass service_type to android logic for UMA metrics
+ // that will eventually be installed there.
AccountManagementScreenHelper::OpenAccountManagementScreen(
Profile::FromBrowserContext(web_contents->GetBrowserContext()));
}
« no previous file with comments | « chrome/browser/signin/signin_header_helper.h ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698