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

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.h

Issue 2616523004: Layout avatar button
Patch Set: More stuff Created 3 years, 11 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
Index: chrome/browser/ui/views/profiles/new_avatar_button.h
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/new_avatar_button.h
index 5cbcb617359b115af693793aa9c098f77ebba766..66b471de71c143ae09f12414025ffa9fd0eafe03 100644
--- a/chrome/browser/ui/views/profiles/new_avatar_button.h
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.h
@@ -15,15 +15,14 @@
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 {
- public:
- NewAvatarButton(AvatarButtonDelegate* delegate,
- AvatarButtonStyle button_style,
- Profile* profile);
- ~NewAvatarButton() override;
+class AvatarButton : public views::LabelButton,
+ public AvatarButtonErrorControllerDelegate,
+ public ProfileAttributesStorage::Observer {
+public:
+ AvatarButton(AvatarButtonDelegate* delegate,
+ AvatarButtonStyle button_style,
+ Profile* profile);
+ ~AvatarButton() override;
// Views::LabelButton
bool OnMousePressed(const ui::MouseEvent& event) override;
@@ -32,7 +31,14 @@ class NewAvatarButton : public views::LabelButton,
// Views
void OnGestureEvent(ui::GestureEvent* event) override;
- private:
+protected:
+ virtual void UpdateButton(bool use_generic_button, Profile* profile, AvatarButtonErrorController* error_controller) = 0;
+
+ // 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();
+
+private:
friend class ProfileChooserViewExtensionsTest;
// AvatarButtonErrorControllerDelegate:
@@ -41,30 +47,55 @@ class NewAvatarButton : public views::LabelButton,
// ProfileAttributesStorage::Observer:
void OnProfileAdded(const base::FilePath& profile_path) override;
void OnProfileWasRemoved(const base::FilePath& profile_path,
- const base::string16& profile_name) override;
+ const base::string16& profile_name) override;
void OnProfileNameChanged(const base::FilePath& profile_path,
- const base::string16& old_profile_name) override;
+ const base::string16& old_profile_name) override;
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();
+ const base::FilePath& profile_path) override;
AvatarButtonDelegate* delegate_;
AvatarButtonErrorController error_controller_;
Profile* profile_;
- // The icon displayed instead of the profile name in the local profile case.
- // 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(AvatarButton);
+};
+
+// Avatar button that displays the active profile's name in the caption area.
+class NewAvatarButton : public AvatarButton {
+ public:
+ NewAvatarButton(AvatarButtonDelegate* delegate,
+ AvatarButtonStyle button_style,
+ Profile* profile);
+ ~NewAvatarButton() override;
+
+ protected:
+ void UpdateButton(bool use_generic_button, Profile* profile, AvatarButtonErrorController* error_controller) override;
+
+private:
+ // The icon displayed instead of the profile name in the local profile case.
+ // Different assets are used depending on the OS version.
+ gfx::ImageSkia generic_avatar_;
+
DISALLOW_COPY_AND_ASSIGN(NewAvatarButton);
};
+//class MaterialDesignAvatarButton : public AvatarButton {
+//public:
+// MaterialDesignAvatarButton(AvatarButtonDelegate* delegate,
+// AvatarButtonStyle button_style,
+// Profile* profile);
+// ~MaterialDesignAvatarButton() override;
+//
+//protected:
+// void Update(bool use_generic_button) override;
+//
+//private:
+// DISALLOW_COPY_AND_ASSIGN(MaterialDesignAvatarButton);
+//};
+
#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_

Powered by Google App Engine
This is Rietveld 408576698