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 UpdateAvatarButtonAndRelayoutParent(); | 143 UpdateAvatarButtonAndRelayoutParent(); |
144 } | 144 } |
145 | 145 |
146 void NewAvatarButton::OnProfileNameChanged( | 146 void NewAvatarButton::OnProfileNameChanged( |
147 const base::FilePath& profile_path, | 147 const base::FilePath& profile_path, |
148 const base::string16& old_profile_name) { | 148 const base::string16& old_profile_name) { |
149 if (browser_->profile()->GetPath() == profile_path) | 149 if (browser_->profile()->GetPath() == profile_path) |
150 UpdateAvatarButtonAndRelayoutParent(); | 150 UpdateAvatarButtonAndRelayoutParent(); |
151 } | 151 } |
152 | 152 |
153 void NewAvatarButton::OnProfileAvatarChanged( | |
154 const base::FilePath& profile_path) { | |
155 if (browser_->profile()->GetPath() == profile_path) | |
156 UpdateAvatarButtonAndRelayoutParent(); | |
157 } | |
158 | |
159 void NewAvatarButton::OnProfileSupervisedUserIdChanged( | 153 void NewAvatarButton::OnProfileSupervisedUserIdChanged( |
160 const base::FilePath& profile_path) { | 154 const base::FilePath& profile_path) { |
161 if (browser_->profile()->GetPath() == profile_path) | 155 if (browser_->profile()->GetPath() == profile_path) |
162 UpdateAvatarButtonAndRelayoutParent(); | 156 UpdateAvatarButtonAndRelayoutParent(); |
163 } | 157 } |
164 | 158 |
165 void NewAvatarButton::OnErrorChanged() { | 159 void NewAvatarButton::OnErrorChanged() { |
166 // If there is an error, show an warning icon. | 160 // If there is an error, show an warning icon. |
167 const SigninErrorController* error = | 161 const SigninErrorController* error = |
168 profiles::GetSigninErrorController(browser_->profile()); | 162 profiles::GetSigninErrorController(browser_->profile()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const int kDefaultImageTextSpacing = 5; | 202 const int kDefaultImageTextSpacing = 5; |
209 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 203 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
210 | 204 |
211 InvalidateLayout(); | 205 InvalidateLayout(); |
212 | 206 |
213 // Because the width of the button might have changed, the parent browser | 207 // Because the width of the button might have changed, the parent browser |
214 // frame needs to recalculate the button bounds and redraw it. | 208 // frame needs to recalculate the button bounds and redraw it. |
215 if (parent()) | 209 if (parent()) |
216 parent()->Layout(); | 210 parent()->Layout(); |
217 } | 211 } |
OLD | NEW |