Commit 33e995f3 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Fix crash for Unicorn on Chrome OS, on sign out from another device

Bug: 807568
Change-Id: Id9b249fdbacfcd7b64cc7256a33204778f437450
Reviewed-on: https://chromium-review.googlesource.com/897671
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534015}
parent cdbc3669
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/signin/chrome_signin_helper.h" #include "chrome/browser/signin/chrome_signin_helper.h"
#include <memory> #include <memory>
#include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
...@@ -50,7 +51,6 @@ ...@@ -50,7 +51,6 @@
#include "chrome/browser/android/signin/account_management_screen_helper.h" #include "chrome/browser/android/signin/account_management_screen_helper.h"
#else #else
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
...@@ -192,7 +192,6 @@ void ProcessMirrorHeaderUIThread( ...@@ -192,7 +192,6 @@ void ProcessMirrorHeaderUIThread(
const content::ResourceRequestInfo::WebContentsGetter& const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter) { web_contents_getter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(IsAccountConsistencyMirrorEnabled());
GAIAServiceType service_type = manage_accounts_params.service_type; GAIAServiceType service_type = manage_accounts_params.service_type;
DCHECK_NE(GAIA_SERVICE_TYPE_NONE, service_type); DCHECK_NE(GAIA_SERVICE_TYPE_NONE, service_type);
...@@ -203,6 +202,9 @@ void ProcessMirrorHeaderUIThread( ...@@ -203,6 +202,9 @@ void ProcessMirrorHeaderUIThread(
Profile* profile = Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext()); Profile::FromBrowserContext(web_contents->GetBrowserContext());
DCHECK(AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile))
<< "Gaia should not send the X-Chrome-Manage-Accounts header "
<< "when Mirror is disabled.";
AccountReconcilor* account_reconcilor = AccountReconcilor* account_reconcilor =
AccountReconcilorFactory::GetForProfile(profile); AccountReconcilorFactory::GetForProfile(profile);
account_reconcilor->OnReceivedManageAccountsResponse(service_type); account_reconcilor->OnReceivedManageAccountsResponse(service_type);
...@@ -225,6 +227,16 @@ void ProcessMirrorHeaderUIThread( ...@@ -225,6 +227,16 @@ void ProcessMirrorHeaderUIThread(
} }
signin_metrics::LogAccountReconcilorStateOnGaiaResponse( signin_metrics::LogAccountReconcilorStateOnGaiaResponse(
account_reconcilor->GetState()); account_reconcilor->GetState());
#if defined(OS_CHROMEOS)
// Chrome OS does not have an account picker right now. To fix
// https://crbug.com/807568, this is a no-op here. This is OK because in the
// limited cases that Mirror is available on Chrome OS, 1:1 account
// consistency is enforced and adding/removing accounts is not allowed,
// GAIA_SERVICE_TYPE_INCOGNITO may be allowed though.
return;
#endif
browser->window()->ShowAvatarBubbleFromAvatarButton( browser->window()->ShowAvatarBubbleFromAvatarButton(
bubble_mode, manage_accounts_params, bubble_mode, manage_accounts_params,
signin_metrics::AccessPoint::ACCESS_POINT_CONTENT_AREA, false); signin_metrics::AccessPoint::ACCESS_POINT_CONTENT_AREA, false);
...@@ -348,12 +360,6 @@ void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request, ...@@ -348,12 +360,6 @@ void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request,
return; return;
} }
if (!IsAccountConsistencyMirrorEnabled()) {
NOTREACHED() << "Gaia should not send the X-Chrome-Manage-Accounts header "
<< "when Mirror is disabled.";
return;
}
ManageAccountsParams params = BuildManageAccountsParams(header_value); ManageAccountsParams params = BuildManageAccountsParams(header_value);
// If the request does not have a response header or if the header contains // If the request does not have a response header or if the header contains
// garbage, then |service_type| is set to |GAIA_SERVICE_TYPE_NONE|. // garbage, then |service_type| is set to |GAIA_SERVICE_TYPE_NONE|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment