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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const base::string16& profile_name) { | 120 const base::string16& profile_name) { |
121 UpdateAvatarButtonAndRelayoutParent(); | 121 UpdateAvatarButtonAndRelayoutParent(); |
122 } | 122 } |
123 | 123 |
124 void NewAvatarButton::OnProfileNameChanged( | 124 void NewAvatarButton::OnProfileNameChanged( |
125 const base::FilePath& profile_path, | 125 const base::FilePath& profile_path, |
126 const base::string16& old_profile_name) { | 126 const base::string16& old_profile_name) { |
127 UpdateAvatarButtonAndRelayoutParent(); | 127 UpdateAvatarButtonAndRelayoutParent(); |
128 } | 128 } |
129 | 129 |
| 130 void NewAvatarButton::OnProfileAvatarChanged( |
| 131 const base::FilePath& profile_path) { |
| 132 UpdateAvatarButtonAndRelayoutParent(); |
| 133 } |
| 134 |
130 void NewAvatarButton::OnProfileSupervisedUserIdChanged( | 135 void NewAvatarButton::OnProfileSupervisedUserIdChanged( |
131 const base::FilePath& profile_path) { | 136 const base::FilePath& profile_path) { |
132 UpdateAvatarButtonAndRelayoutParent(); | 137 UpdateAvatarButtonAndRelayoutParent(); |
133 } | 138 } |
134 | 139 |
135 void NewAvatarButton::OnErrorChanged() { | 140 void NewAvatarButton::OnErrorChanged() { |
136 gfx::ImageSkia icon; | 141 gfx::ImageSkia icon; |
137 | 142 |
138 // If there is an error, show an warning icon. | 143 // If there is an error, show an warning icon. |
139 const SigninErrorController* error = | 144 const SigninErrorController* error = |
(...skipping 11 matching lines...) Expand all Loading... |
151 // We want the button to resize if the new text is shorter. | 156 // We want the button to resize if the new text is shorter. |
152 SetText(profiles::GetAvatarButtonTextForProfile(browser_->profile())); | 157 SetText(profiles::GetAvatarButtonTextForProfile(browser_->profile())); |
153 SetMinSize(gfx::Size()); | 158 SetMinSize(gfx::Size()); |
154 InvalidateLayout(); | 159 InvalidateLayout(); |
155 | 160 |
156 // Because the width of the button might have changed, the parent browser | 161 // Because the width of the button might have changed, the parent browser |
157 // frame needs to recalculate the button bounds and redraw it. | 162 // frame needs to recalculate the button bounds and redraw it. |
158 if (parent()) | 163 if (parent()) |
159 parent()->Layout(); | 164 parent()->Layout(); |
160 } | 165 } |
OLD | NEW |