Skip to content

Commit

Permalink
Fix #11444: Google accounts should not show in the profile menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jumde committed Aug 26, 2020
1 parent ea36a29 commit fef6c87
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 0 deletions.
29 changes: 29 additions & 0 deletions browser/profiles/brave_gaia_info_update_service.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/profiles/brave_gaia_info_update_service.h"

#include "base/files/file_path.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"

BraveGAIAInfoUpdateService::BraveGAIAInfoUpdateService(
signin::IdentityManager* identity_manager,
ProfileAttributesStorage* profile_attributes_storage,
const base::FilePath& profile_path,
PrefService* prefs)
: GAIAInfoUpdateService(identity_manager,
profile_attributes_storage,
profile_path,
prefs) {}

BraveGAIAInfoUpdateService::~BraveGAIAInfoUpdateService() {}

// static
bool BraveGAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) {
return false;
}
36 changes: 36 additions & 0 deletions browser/profiles/brave_gaia_info_update_service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_BROWSER_PROFILES_BRAVE_GAIA_INFO_UPDATE_SERVICE_H_
#define BRAVE_BROWSER_PROFILES_BRAVE_GAIA_INFO_UPDATE_SERVICE_H_

#include "chrome/browser/profiles/gaia_info_update_service.h"

class PrefService;
class Profile;
class ProfileAttributesStorage;

namespace base {
class FilePath;
}
namespace signin {
class IdentityManager;
}

class BraveGAIAInfoUpdateService : public GAIAInfoUpdateService {
public:
BraveGAIAInfoUpdateService(
signin::IdentityManager* identity_manager,
ProfileAttributesStorage* profile_attributes_storage,
const base::FilePath& profile_path,
PrefService* prefs);

~BraveGAIAInfoUpdateService() override;

// Checks if downloading GAIA info for the given profile is allowed.
static bool ShouldUseGAIAProfileInfo(Profile* profile);
};

#endif // BRAVE_BROWSER_PROFILES_BRAVE_GAIA_INFO_UPDATE_SERVICE_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/profiles/brave_gaia_info_update_service.cc"
#include "../../../../../chrome/browser/profiles/gaia_info_update_service.cc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/profiles/brave_gaia_info_update_service.h"

#define GAIAInfoUpdateService BraveGAIAInfoUpdateService
#include "../../../../../chrome/browser/profiles/gaia_info_update_service_factory.cc"
#undef GAIAInfoUpdateService
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_

#define GetAvatarIcon virtual GetAvatarIcon
#define AvatarToolbarButtonDelegate BraveAvatarToolbarButtonDelegate
#include "../../../../../../../chrome/browser/ui/views/profiles/avatar_toolbar_button.h"
#undef AvatarToolbarButtonDelegate
#undef GetAvatarIcon

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ AvatarToolbarButton::State BraveAvatarToolbarButtonDelegate::GetState() const {
return state;
}

gfx::Image BraveAvatarToolbarButtonDelegate::GetGaiaAccountImage() const {
return gfx::Image();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class BraveAvatarToolbarButtonDelegate : public AvatarToolbarButtonDelegate {
~BraveAvatarToolbarButtonDelegate() override = default;

void Init(AvatarToolbarButton* button, Profile* profile) override;
gfx::Image GetGaiaAccountImage() const;
AvatarToolbarButton::State GetState() const override;

private:
Expand Down

0 comments on commit fef6c87

Please sign in to comment.