| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" | 5 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" |
| 6 | 6 |
| 7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" | 10 #include "chrome/browser/profiles/profiles_state.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR).ToImageSkia(); | 143 IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR).ToImageSkia(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 SetImage(views::Button::STATE_NORMAL, icon); | 146 SetImage(views::Button::STATE_NORMAL, icon); |
| 147 UpdateAvatarButtonAndRelayoutParent(); | 147 UpdateAvatarButtonAndRelayoutParent(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() { | 150 void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() { |
| 151 // We want the button to resize if the new text is shorter. | 151 // We want the button to resize if the new text is shorter. |
| 152 SetText(profiles::GetAvatarButtonTextForProfile(browser_->profile())); | 152 SetText(profiles::GetAvatarButtonTextForProfile(browser_->profile())); |
| 153 set_min_size(gfx::Size()); | 153 SetMinSize(gfx::Size()); |
| 154 InvalidateLayout(); | 154 InvalidateLayout(); |
| 155 | 155 |
| 156 // Because the width of the button might have changed, the parent browser | 156 // Because the width of the button might have changed, the parent browser |
| 157 // frame needs to recalculate the button bounds and redraw it. | 157 // frame needs to recalculate the button bounds and redraw it. |
| 158 if (parent()) | 158 if (parent()) |
| 159 parent()->Layout(); | 159 parent()->Layout(); |
| 160 } | 160 } |
| OLD | NEW |