Commit c90892e4 authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Revert "Show promo account icon in toolbar when user is signed out"

This reverts commit c5604690.

Reason for revert: Causes BrowserViewTest suite to fail under Refresh on Linux. See crbug.com/855797

Original change's description:
> Show promo account icon in toolbar when user is signed out
> 
> When the user is signed out of Chrome and the profile icon
> has not been explicitly changed, AvatarToolbarButton now
> uses the account icon of the first sync promo account.
> 
> Screenshots:
> https://drive.google.com/file/d/1a7kr12KtA11Wt7MQ9MLnSf-M3D9nlLdg/view?usp=sharing
> https://drive.google.com/file/d/1nKLnoD1sbcZOvwGQY3YtHVTUv32DQNFn/view?usp=sharing
> 
> Bug: 853363
> Change-Id: I11ed80e2250bc4eb9202e4a1c4cabf242954f726
> Reviewed-on: https://chromium-review.googlesource.com/1105772
> Commit-Queue: Thomas Tangl <tangltom@chromium.org>
> Reviewed-by: David Roger <droger@chromium.org>
> Reviewed-by: Trent Apted <tapted@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#569213}

TBR=droger@chromium.org,tapted@chromium.org,tangltom@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 853363
Change-Id: Ib8d9a5350277146050677a2676577d29b315efda
Reviewed-on: https://chromium-review.googlesource.com/1112599Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569870}
parent d969f8bf
......@@ -14,10 +14,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/signin_ui_util.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/layout_constants.h"
......@@ -40,19 +37,10 @@ AvatarToolbarButton::AvatarToolbarButton(Profile* profile,
#if !defined(OS_CHROMEOS)
error_controller_(this, profile_),
#endif // !defined(OS_CHROMEOS)
profile_observer_(this),
cookie_manager_service_observer_(this),
account_tracker_service_observer_(this) {
profile_observer_(this) {
profile_observer_.Add(
&g_browser_process->profile_manager()->GetProfileAttributesStorage());
if (!IsIncognito() && !profile_->IsGuestSession()) {
cookie_manager_service_observer_.Add(
GaiaCookieManagerServiceFactory::GetForProfile(profile_));
account_tracker_service_observer_.Add(
AccountTrackerServiceFactory::GetForProfile(profile_));
}
SetImageAlignment(HorizontalAlignment::ALIGN_CENTER,
VerticalAlignment::ALIGN_MIDDLE);
......@@ -134,18 +122,6 @@ void AvatarToolbarButton::OnProfileNameChanged(
UpdateTooltipText();
}
void AvatarToolbarButton::OnGaiaAccountsInCookieUpdated(
const std::vector<gaia::ListedAccount>& accounts,
const std::vector<gaia::ListedAccount>& signed_out_accounts,
const GoogleServiceAuthError& error) {
UpdateIcon();
}
void AvatarToolbarButton::OnAccountImageUpdated(const std::string& account_id,
const gfx::Image& image) {
UpdateIcon();
}
bool AvatarToolbarButton::IsIncognito() const {
return profile_->IsOffTheRecord() && !profile_->IsGuestSession();
}
......@@ -155,10 +131,6 @@ bool AvatarToolbarButton::ShouldShowGenericIcon() const {
// sessions should be handled separately and never call this function.
DCHECK(!profile_->IsGuestSession());
DCHECK(!profile_->IsOffTheRecord());
#if !defined(OS_CHROMEOS)
if (!signin_ui_util::GetAccountsForDicePromos(profile_).empty())
return false;
#endif // !defined(OS_CHROMEOS)
return g_browser_process->profile_manager()
->GetProfileAttributesStorage()
.GetNumberOfProfiles() == 1 &&
......@@ -251,20 +223,6 @@ gfx::Image AvatarToolbarButton::GetIconImageFromProfile() const {
return gfx::Image();
}
#if !defined(OS_CHROMEOS)
// If the user isn't signed in and the profile icon wasn't changed explicitly,
// try to use the first account icon of the sync promo.
if (!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated() &&
entry->GetAvatarIconIndex() == 0) {
std::vector<AccountInfo> promo_accounts =
signin_ui_util::GetAccountsForDicePromos(profile_);
if (!promo_accounts.empty()) {
return AccountTrackerServiceFactory::GetForProfile(profile_)
->GetAccountImage(promo_accounts[0].account_id);
}
}
#endif // !defined(OS_CHROMEOS)
return entry->GetAvatarIcon();
}
......
......@@ -12,14 +12,10 @@
#include "chrome/browser/ui/avatar_button_error_controller.h"
#include "chrome/browser/ui/avatar_button_error_controller_delegate.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/gaia_cookie_manager_service.h"
class AvatarToolbarButton : public ToolbarButton,
public AvatarButtonErrorControllerDelegate,
public ProfileAttributesStorage::Observer,
public GaiaCookieManagerService::Observer,
public AccountTrackerService::Observer {
public ProfileAttributesStorage::Observer {
public:
AvatarToolbarButton(Profile* profile, views::ButtonListener* listener);
~AvatarToolbarButton() override;
......@@ -43,18 +39,6 @@ class AvatarToolbarButton : public ToolbarButton,
void OnProfileNameChanged(const base::FilePath& profile_path,
const base::string16& old_profile_name) override;
// GaiaCookieManagerService::Observer:
// Needed if the first sync promo account should be displayed.
void OnGaiaAccountsInCookieUpdated(
const std::vector<gaia::ListedAccount>& accounts,
const std::vector<gaia::ListedAccount>& signed_out_accounts,
const GoogleServiceAuthError& error) override;
// AccountTrackerService::Observer:
// Needed if the first sync promo account should be displayed.
void OnAccountImageUpdated(const std::string& account_id,
const gfx::Image& image) override;
bool IsIncognito() const;
bool ShouldShowGenericIcon() const;
base::string16 GetAvatarTooltipText();
......@@ -69,10 +53,6 @@ class AvatarToolbarButton : public ToolbarButton,
#endif // !defined(OS_CHROMEOS)
ScopedObserver<ProfileAttributesStorage, AvatarToolbarButton>
profile_observer_;
ScopedObserver<GaiaCookieManagerService, AvatarToolbarButton>
cookie_manager_service_observer_;
ScopedObserver<AccountTrackerService, AvatarToolbarButton>
account_tracker_service_observer_;
DISALLOW_COPY_AND_ASSIGN(AvatarToolbarButton);
};
......
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