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 "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/profiles/profile_attributes_entry.h" | 12 #include "chrome/browser/profiles/profile_attributes_entry.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/profiles/profiles_state.h" | 14 #include "chrome/browser/profiles/profiles_state.h" |
15 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" | 15 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" |
16 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 16 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
17 #include "components/signin/core/common/profile_management_switches.h" | |
17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.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/gfx/vector_icons_public.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" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 ? gfx::ShadowValues() | 207 ? gfx::ShadowValues() |
207 : gfx::ShadowValues( | 208 : gfx::ShadowValues( |
208 10, gfx::ShadowValue(gfx::Vector2d(), 1.0f, SK_ColorDKGRAY))); | 209 10, gfx::ShadowValue(gfx::Vector2d(), 1.0f, SK_ColorDKGRAY))); |
209 | 210 |
210 // We want the button to resize if the new text is shorter. | 211 // We want the button to resize if the new text is shorter. |
211 SetMinSize(gfx::Size()); | 212 SetMinSize(gfx::Size()); |
212 | 213 |
213 if (use_generic_button) { | 214 if (use_generic_button) { |
214 SetImage(views::Button::STATE_NORMAL, generic_avatar_); | 215 SetImage(views::Button::STATE_NORMAL, generic_avatar_); |
215 } else if (has_auth_error_) { | 216 } else if (has_auth_error_) { |
216 SetImage(views::Button::STATE_NORMAL, | 217 if (switches::IsMaterialDesignUserMenu()) { |
217 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 13, | 218 SetImage(views::Button::STATE_NORMAL, |
218 gfx::kGoogleYellow700)); | 219 gfx::CreateVectorIcon(gfx::VectorIconId::SYNC_PROBLEM, 13, |
220 gfx::kGoogleRed700)); | |
221 } else { | |
222 SetImage(views::Button::STATE_NORMAL, | |
223 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 13, | |
224 gfx::kGoogleYellow700)); | |
Roger Tawa OOO till Jul 10th
2016/06/06 20:56:54
Nit: 223 and 224 may need to be indented a bit mor
| |
225 } | |
219 } else { | 226 } else { |
220 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 227 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
221 } | 228 } |
222 | 229 |
223 // If we are not using the generic button, then reset the spacing between | 230 // If we are not using the generic button, then reset the spacing between |
224 // the text and the possible authentication error icon. | 231 // the text and the possible authentication error icon. |
225 const int kDefaultImageTextSpacing = 5; | 232 const int kDefaultImageTextSpacing = 5; |
226 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 233 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
227 | 234 |
228 PreferredSizeChanged(); | 235 PreferredSizeChanged(); |
229 delegate_->ButtonPreferredSizeChanged(); | 236 delegate_->ButtonPreferredSizeChanged(); |
230 } | 237 } |
OLD | NEW |