Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / profiles / new_avatar_button.cc
index 2fe40ae..2e3647c 100644 (file)
@@ -61,6 +61,12 @@ NewAvatarButton::NewAvatarButton(
       gfx::ShadowValue(gfx::Point(), 1.0f, SK_ColorDKGRAY)));
   SetTextSubpixelRenderingEnabled(false);
 
+  // The largest text height that fits in the button. If the font list height
+  // is larger than this, it will be shrunk to match it.
+  // TODO(noms): Calculate this constant algorithmically.
+  const int kDisplayFontHeight = 15;
+  SetFontList(GetFontList().DeriveWithHeightUpperBound(kDisplayFontHeight));
+
   ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
   if (button_style == THEMED_BUTTON) {
     const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL);
@@ -142,6 +148,11 @@ void NewAvatarButton::OnProfileNameChanged(
   UpdateAvatarButtonAndRelayoutParent();
 }
 
+void NewAvatarButton::OnProfileAvatarChanged(
+      const base::FilePath& profile_path) {
+  UpdateAvatarButtonAndRelayoutParent();
+}
+
 void NewAvatarButton::OnProfileSupervisedUserIdChanged(
       const base::FilePath& profile_path) {
   UpdateAvatarButtonAndRelayoutParent();