| Index: chrome/browser/ui/views/profiles/avatar_button.h
|
| diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/avatar_button.h
|
| similarity index 55%
|
| rename from chrome/browser/ui/views/profiles/new_avatar_button.h
|
| rename to chrome/browser/ui/views/profiles/avatar_button.h
|
| index 5cbcb617359b115af693793aa9c098f77ebba766..e71d8a02743f89277ca308482790b148086961b0 100644
|
| --- a/chrome/browser/ui/views/profiles/new_avatar_button.h
|
| +++ b/chrome/browser/ui/views/profiles/avatar_button.h
|
| @@ -2,35 +2,39 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
|
| -#define CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
|
| +#ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
|
| +#define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
|
|
|
| #include "base/macros.h"
|
| #include "chrome/browser/profiles/profile_attributes_storage.h"
|
| #include "chrome/browser/ui/avatar_button_error_controller.h"
|
| #include "chrome/browser/ui/avatar_button_error_controller_delegate.h"
|
| #include "chrome/browser/ui/views/profiles/avatar_button_style.h"
|
| -#include "ui/views/controls/button/label_button.h"
|
| +#include "ui/views/controls/button/menu_button.h"
|
|
|
| -class AvatarButtonDelegate;
|
| class Profile;
|
|
|
| -// Avatar button that displays the active profile's name in the caption area.
|
| -class NewAvatarButton : public views::LabelButton,
|
| - public AvatarButtonErrorControllerDelegate,
|
| - public ProfileAttributesStorage::Observer {
|
| +// Base class for avatar buttons that display the active profile's name in the
|
| +// caption area.
|
| +class AvatarButton : public views::MenuButton,
|
| + public AvatarButtonErrorControllerDelegate,
|
| + public ProfileAttributesStorage::Observer {
|
| public:
|
| - NewAvatarButton(AvatarButtonDelegate* delegate,
|
| - AvatarButtonStyle button_style,
|
| - Profile* profile);
|
| - ~NewAvatarButton() override;
|
| + ~AvatarButton() override;
|
|
|
| - // Views::LabelButton
|
| - bool OnMousePressed(const ui::MouseEvent& event) override;
|
| - void OnMouseReleased(const ui::MouseEvent& event) override;
|
| + protected:
|
| + AvatarButton(views::MenuButtonListener* listener, Profile* profile);
|
|
|
| - // Views
|
| - void OnGestureEvent(ui::GestureEvent* event) override;
|
| + // MenuButton
|
| + bool IsTriggerableEvent(const ui::Event& event) override;
|
| +
|
| + // Called when the profile info cache or signin/sync error has changed, which
|
| + // means we might have to update the icon/text of the button.
|
| + void Update();
|
| +
|
| + void set_generic_avatar(const gfx::ImageSkia& generic_avatar) {
|
| + generic_avatar_ = generic_avatar;
|
| + }
|
|
|
| private:
|
| friend class ProfileChooserViewExtensionsTest;
|
| @@ -47,11 +51,8 @@ class NewAvatarButton : public views::LabelButton,
|
| void OnProfileSupervisedUserIdChanged(
|
| const base::FilePath& profile_path) override;
|
|
|
| - // Called when the profile info cache or signin/sync error has changed, which
|
| - // means we might have to update the icon/text of the button.
|
| - void Update();
|
| + void UpdateButton(bool use_generic_button);
|
|
|
| - AvatarButtonDelegate* delegate_;
|
| AvatarButtonErrorController error_controller_;
|
| Profile* profile_;
|
|
|
| @@ -59,12 +60,7 @@ class NewAvatarButton : public views::LabelButton,
|
| // Different assets are used depending on the OS version.
|
| gfx::ImageSkia generic_avatar_;
|
|
|
| - // This is used to check if the bubble was showing during the mouse pressed
|
| - // event. If this is true then the mouse released event is ignored to prevent
|
| - // the bubble from reshowing.
|
| - bool suppress_mouse_released_action_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(NewAvatarButton);
|
| + DISALLOW_COPY_AND_ASSIGN(AvatarButton);
|
| };
|
|
|
| -#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
|
| +#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
|
|
|