Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| index 8af320e51d9a69f0e6ca36ed4ae7753e7ec94a5d..1911c54606fe158b23e7b0c05247c2ffba8c67cf 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/macros.h" |
| #include "base/metrics/user_metrics.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "chrome/app/vector_icons/vector_icons.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| @@ -67,9 +68,9 @@ |
| #include "ui/gfx/path.h" |
| #include "ui/gfx/skia_util.h" |
| #include "ui/gfx/text_elider.h" |
| -#include "ui/gfx/vector_icons_public.h" |
| #include "ui/native_theme/common_theme.h" |
| #include "ui/native_theme/native_theme.h" |
| +#include "ui/vector_icons/vector_icons.h" |
| #include "ui/views/controls/button/blue_button.h" |
| #include "ui/views/controls/button/image_button.h" |
| #include "ui/views/controls/button/label_button.h" |
| @@ -453,7 +454,7 @@ class EditableProfilePhoto : public views::LabelButton { |
| photo_overlay_->set_background( |
| views::Background::CreateSolidBackground(kBackgroundColor)); |
| photo_overlay_->SetImage(gfx::CreateVectorIcon( |
| - gfx::VectorIconId::PHOTO_CAMERA, 48u, SkColorSetRGB(0x33, 0x33, 0x33))); |
| + kPhotoCameraIcon, 48u, SkColorSetRGB(0x33, 0x33, 0x33))); |
| photo_overlay_->SetSize(gfx::Size(icon_image_side(), icon_image_side())); |
| photo_overlay_->SetY(badge_spacing()); |
| @@ -497,13 +498,12 @@ class EditableProfilePhoto : public views::LabelButton { |
| ui::NativeTheme::kColorId_BubbleBackground)); |
| canvas->DrawCircle(center_point, GetProfileBadgeSize() / 2, flags); |
| - gfx::VectorIconId icon_id; |
| + const gfx::VectorIcon* icon = nullptr; |
|
Peter Kasting
2017/03/02 23:12:51
Nit: I'd avoid initializing this to avoid implying
Evan Stade
2017/03/03 00:36:38
Done.
|
| int icon_size; |
| SkColor icon_color; |
| if (switches::IsMaterialDesignUserMenu()) { |
| - icon_id = profile_->IsChild() |
| - ? gfx::VectorIconId::ACCOUNT_CHILD_CIRCLE |
| - : gfx::VectorIconId::SUPERVISOR_ACCOUNT_CIRCLE; |
| + icon = profile_->IsChild() ? &kAccountChildCircleIcon |
| + : &kSupervisorAccountCircleIcon; |
| icon_size = 22; |
| icon_color = gfx::kChromeIconGrey; |
| } else { |
| @@ -513,9 +513,8 @@ class EditableProfilePhoto : public views::LabelButton { |
| center_point, GetProfileBadgeSize() / 2 - kProfileBadgeWhitePadding, |
| flags); |
| - icon_id = profile_->IsChild() |
| - ? gfx::VectorIconId::ACCOUNT_CHILD |
| - : gfx::VectorIconId::SUPERVISOR_ACCOUNT; |
| + icon = |
| + profile_->IsChild() ? &kAccountChildIcon : &kSupervisorAccountIcon; |
| icon_size = profile_->IsChild() ? 26 : 20; |
| icon_color = SkColorSetRGB(0, 0x66, 0xff); |
| } |
| @@ -523,7 +522,7 @@ class EditableProfilePhoto : public views::LabelButton { |
| // Paint the badge icon. |
| int offset = (GetProfileBadgeSize() - icon_size) / 2; |
| canvas->Translate(badge_offset_vector + gfx::Vector2d(offset, offset)); |
| - gfx::PaintVectorIcon(canvas, icon_id, icon_size, icon_color); |
| + gfx::PaintVectorIcon(canvas, *icon, icon_size, icon_color); |
| } |
| } |
| @@ -619,13 +618,11 @@ class EditableProfileName : public views::View, |
| button_->SetImage(views::LabelButton::STATE_NORMAL, |
| CreateSquarePlaceholderImage(kIconSize)); |
| button_->SetImage(views::LabelButton::STATE_HOVERED, |
| - gfx::CreateVectorIcon( |
| - gfx::VectorIconId::MODE_EDIT, kIconSize, |
| - SkColorSetRGB(0x33, 0x33, 0x33))); |
| + gfx::CreateVectorIcon(kModeEditIcon, kIconSize, |
| + SkColorSetRGB(0x33, 0x33, 0x33))); |
| button_->SetImage(views::LabelButton::STATE_PRESSED, |
| - gfx::CreateVectorIcon( |
| - gfx::VectorIconId::MODE_EDIT, kIconSize, |
| - SkColorSetRGB(0x20, 0x20, 0x20))); |
| + gfx::CreateVectorIcon(kModeEditIcon, kIconSize, |
| + SkColorSetRGB(0x20, 0x20, 0x20))); |
| // We need to add a left padding as well as a small top/bottom padding |
| // to the text to account for the textfield's border. |
| const int kIconTextLabelButtonSpacing = 5; |
| @@ -1595,8 +1592,8 @@ views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() { |
| // Adds the sync problem icon. |
| views::ImageView* sync_problem_icon = new views::ImageView(); |
| - sync_problem_icon->SetImage(gfx::CreateVectorIcon( |
| - gfx::VectorIconId::SYNC_PROBLEM, 20, gfx::kGoogleRed700)); |
| + sync_problem_icon->SetImage( |
| + gfx::CreateVectorIcon(kSyncProblemIcon, 20, gfx::kGoogleRed700)); |
| view->AddChildView(sync_problem_icon); |
| // Adds a vertical view to organize the error title, message, and button. |
| @@ -1701,8 +1698,7 @@ views::View* ProfileChooserView::CreateCurrentProfileView( |
| auth_error_email_button_->SetElideBehavior(gfx::ELIDE_EMAIL); |
| auth_error_email_button_->SetImage( |
| views::LabelButton::STATE_NORMAL, |
| - gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, |
| - gfx::kChromeIconGrey)); |
| + gfx::CreateVectorIcon(ui::kWarningIcon, 18, gfx::kChromeIconGrey)); |
| auth_error_email_button_->SetFocusForPlatform(); |
| gfx::Insets insets = |
| views::LabelButtonAssetBorder::GetDefaultInsetsForStyle( |
| @@ -1963,7 +1959,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock, |
| if (service->GetBoolean(prefs::kBrowserGuestModeEnabled)) { |
| guest_profile_button_ = new BackgroundColorHoverButton( |
| this, l10n_util::GetStringUTF16(IDS_GUEST_PROFILE_NAME), |
| - gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_CIRCLE, kIconSize, |
| + gfx::CreateVectorIcon(kAccountCircleIcon, kIconSize, |
| gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(guest_profile_button_); |
| @@ -1972,22 +1968,21 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock, |
| } |
| base::string16 text; |
| - gfx::VectorIconId settings_icon; |
| + const gfx::VectorIcon* settings_icon = nullptr; |
| if (switches::IsMaterialDesignUserMenu()) { |
| text = is_guest |
| ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) |
| : l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON); |
| - settings_icon = |
| - is_guest ? gfx::VectorIconId::CLOSE_ALL : gfx::VectorIconId::SETTINGS; |
| + settings_icon = is_guest ? &kCloseAllIcon : &kSettingsIcon; |
| } else { |
| text = is_guest |
| ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) |
| : l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON); |
| - settings_icon = gfx::VectorIconId::ACCOUNT_BOX; |
| + settings_icon = &kAccountBoxIcon; |
| } |
| users_button_ = new BackgroundColorHoverButton( |
| - this, text, gfx::CreateVectorIcon(settings_icon, kIconSize, |
| - gfx::kChromeIconGrey)); |
| + this, text, |
| + gfx::CreateVectorIcon(*settings_icon, kIconSize, gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(users_button_); |
| @@ -2013,8 +2008,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock, |
| lock_button_ = new BackgroundColorHoverButton( |
| this, l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), |
| - gfx::CreateVectorIcon(gfx::VectorIconId::LOCK, kIconSize, |
| - gfx::kChromeIconGrey)); |
| + gfx::CreateVectorIcon(kLockIcon, kIconSize, gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(lock_button_); |
| } else if (switches::IsMaterialDesignUserMenu() && !is_guest) { |
| @@ -2028,7 +2022,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock, |
| close_all_windows_button_ = new BackgroundColorHoverButton( |
| this, |
| l10n_util::GetStringUTF16(IDS_PROFILES_CLOSE_ALL_WINDOWS_BUTTON), |
| - gfx::CreateVectorIcon(gfx::VectorIconId::CLOSE_ALL, kIconSize, |
| + gfx::CreateVectorIcon(kCloseAllIcon, kIconSize, |
| gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(close_all_windows_button_); |
| @@ -2127,8 +2121,8 @@ void ProfileChooserView::CreateAccountButton(views::GridLayout* layout, |
| int warning_button_width = 0; |
| if (reauth_required) { |
| const int kIconSize = 18; |
| - warning_default_image = gfx::CreateVectorIcon( |
| - gfx::VectorIconId::WARNING, kIconSize, gfx::kChromeIconGrey); |
| + warning_default_image = gfx::CreateVectorIcon(ui::kWarningIcon, kIconSize, |
| + gfx::kChromeIconGrey); |
| warning_button_width = kIconSize + views::kRelatedButtonHSpacing; |
| } |
| int available_width = width - 2 * views::kButtonHEdgeMarginNew - |
| @@ -2369,8 +2363,7 @@ views::View* ProfileChooserView::CreateSwitchUserView() { |
| const int kIconSize = 24; |
| add_person_button_ = new BackgroundColorHoverButton( |
| this, l10n_util::GetStringUTF16(IDS_PROFILES_ADD_PERSON_BUTTON), |
| - gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_BOX, kIconSize, |
| - gfx::kChromeIconGrey)); |
| + gfx::CreateVectorIcon(kAccountBoxIcon, kIconSize, gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(add_person_button_); |
| @@ -2380,8 +2373,7 @@ views::View* ProfileChooserView::CreateSwitchUserView() { |
| disconnect_button_ = new BackgroundColorHoverButton( |
| this, l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON), |
| - gfx::CreateVectorIcon(gfx::VectorIconId::REMOVE_BOX, kIconSize, |
| - gfx::kChromeIconGrey)); |
| + gfx::CreateVectorIcon(kRemoveBoxIcon, kIconSize, gfx::kChromeIconGrey)); |
| layout->StartRow(1, 0); |
| layout->AddView(disconnect_button_); |