| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ? gfx::ShadowValues() | 194 ? gfx::ShadowValues() |
| 195 : gfx::ShadowValues( | 195 : gfx::ShadowValues( |
| 196 10, gfx::ShadowValue(gfx::Vector2d(), 2.0f, SK_ColorDKGRAY))); | 196 10, gfx::ShadowValue(gfx::Vector2d(), 2.0f, SK_ColorDKGRAY))); |
| 197 | 197 |
| 198 // We want the button to resize if the new text is shorter. | 198 // We want the button to resize if the new text is shorter. |
| 199 SetMinSize(gfx::Size()); | 199 SetMinSize(gfx::Size()); |
| 200 | 200 |
| 201 if (use_generic_button) { | 201 if (use_generic_button) { |
| 202 SetImage(views::Button::STATE_NORMAL, generic_avatar_); | 202 SetImage(views::Button::STATE_NORMAL, generic_avatar_); |
| 203 } else if (error_controller_.HasAvatarError()) { | 203 } else if (error_controller_.HasAvatarError()) { |
| 204 if (switches::IsMaterialDesignUserMenu()) { | 204 SetImage(views::Button::STATE_NORMAL, |
| 205 SetImage(views::Button::STATE_NORMAL, | 205 gfx::CreateVectorIcon(kSyncProblemIcon, 16, gfx::kGoogleRed700)); |
| 206 gfx::CreateVectorIcon(kSyncProblemIcon, 16, gfx::kGoogleRed700)); | |
| 207 } else { | |
| 208 SetImage( | |
| 209 views::Button::STATE_NORMAL, | |
| 210 gfx::CreateVectorIcon(ui::kWarningIcon, 13, gfx::kGoogleYellow700)); | |
| 211 } | |
| 212 } else { | 206 } else { |
| 213 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 207 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
| 214 } | 208 } |
| 215 | 209 |
| 216 // If we are not using the generic button, then reset the spacing between | 210 // If we are not using the generic button, then reset the spacing between |
| 217 // the text and the possible authentication error icon. | 211 // the text and the possible authentication error icon. |
| 218 const int kDefaultImageTextSpacing = 5; | 212 const int kDefaultImageTextSpacing = 5; |
| 219 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 213 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
| 220 | 214 |
| 221 PreferredSizeChanged(); | 215 PreferredSizeChanged(); |
| 222 delegate_->ButtonPreferredSizeChanged(); | 216 delegate_->ButtonPreferredSizeChanged(); |
| 223 } | 217 } |
| OLD | NEW |