| 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/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/profiles/profile_attributes_entry.h" | 12 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/profiles/profiles_state.h" | 14 #include "chrome/browser/profiles/profiles_state.h" |
| 14 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" | 15 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" |
| 15 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 16 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 16 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
| 17 #include "components/signin/core/common/profile_management_switches.h" | 18 #include "components/signin/core/common/profile_management_switches.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/color_palette.h" | 21 #include "ui/gfx/color_palette.h" |
| 21 #include "ui/gfx/geometry/vector2d.h" | 22 #include "ui/gfx/geometry/vector2d.h" |
| 22 #include "ui/gfx/paint_vector_icon.h" | 23 #include "ui/gfx/paint_vector_icon.h" |
| 23 #include "ui/gfx/vector_icons_public.h" | 24 #include "ui/vector_icons/vector_icons.h" |
| 24 #include "ui/views/border.h" | 25 #include "ui/views/border.h" |
| 25 #include "ui/views/controls/button/label_button_border.h" | 26 #include "ui/views/controls/button/label_button_border.h" |
| 26 #include "ui/views/painter.h" | 27 #include "ui/views/painter.h" |
| 27 | 28 |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 10, gfx::ShadowValue(gfx::Vector2d(), 2.0f, SK_ColorDKGRAY))); | 196 10, gfx::ShadowValue(gfx::Vector2d(), 2.0f, SK_ColorDKGRAY))); |
| 196 | 197 |
| 197 // 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. |
| 198 SetMinSize(gfx::Size()); | 199 SetMinSize(gfx::Size()); |
| 199 | 200 |
| 200 if (use_generic_button) { | 201 if (use_generic_button) { |
| 201 SetImage(views::Button::STATE_NORMAL, generic_avatar_); | 202 SetImage(views::Button::STATE_NORMAL, generic_avatar_); |
| 202 } else if (error_controller_.HasAvatarError()) { | 203 } else if (error_controller_.HasAvatarError()) { |
| 203 if (switches::IsMaterialDesignUserMenu()) { | 204 if (switches::IsMaterialDesignUserMenu()) { |
| 204 SetImage(views::Button::STATE_NORMAL, | 205 SetImage(views::Button::STATE_NORMAL, |
| 205 gfx::CreateVectorIcon(gfx::VectorIconId::SYNC_PROBLEM, 16, | 206 gfx::CreateVectorIcon(kSyncProblemIcon, 16, gfx::kGoogleRed700)); |
| 206 gfx::kGoogleRed700)); | |
| 207 } else { | 207 } else { |
| 208 SetImage(views::Button::STATE_NORMAL, | 208 SetImage( |
| 209 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 13, | 209 views::Button::STATE_NORMAL, |
| 210 gfx::kGoogleYellow700)); | 210 gfx::CreateVectorIcon(ui::kWarningIcon, 13, gfx::kGoogleYellow700)); |
| 211 } | 211 } |
| 212 } else { | 212 } else { |
| 213 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 213 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 // If we are not using the generic button, then reset the spacing between | 216 // If we are not using the generic button, then reset the spacing between |
| 217 // the text and the possible authentication error icon. | 217 // the text and the possible authentication error icon. |
| 218 const int kDefaultImageTextSpacing = 5; | 218 const int kDefaultImageTextSpacing = 5; |
| 219 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 219 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
| 220 | 220 |
| 221 PreferredSizeChanged(); | 221 PreferredSizeChanged(); |
| 222 delegate_->ButtonPreferredSizeChanged(); | 222 delegate_->ButtonPreferredSizeChanged(); |
| 223 } | 223 } |
| OLD | NEW |