Chromium Code Reviews| 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/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 class BackgroundColorHoverButton : public views::LabelButton { | 188 class BackgroundColorHoverButton : public views::LabelButton { |
| 189 public: | 189 public: |
| 190 BackgroundColorHoverButton(ProfileChooserView* profile_chooser_view, | 190 BackgroundColorHoverButton(ProfileChooserView* profile_chooser_view, |
| 191 const base::string16& text) | 191 const base::string16& text) |
| 192 : views::LabelButton(profile_chooser_view, text), | 192 : views::LabelButton(profile_chooser_view, text), |
| 193 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 193 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 194 profile_chooser_view_(profile_chooser_view), | 194 profile_chooser_view_(profile_chooser_view), |
| 195 #endif | 195 #endif |
| 196 title_(nullptr), | 196 title_(nullptr), |
| 197 subtitle_(nullptr) { | 197 subtitle_(nullptr) { |
| 198 DCHECK(profile_chooser_view); | |
| 198 SetImageLabelSpacing(switches::IsMaterialDesignUserMenu() | 199 SetImageLabelSpacing(switches::IsMaterialDesignUserMenu() |
| 199 ? (kMaterialMenuEdgeMargin - 2) | 200 ? (kMaterialMenuEdgeMargin - 2) |
| 200 : views::kItemLabelSpacing); | 201 : views::kItemLabelSpacing); |
| 201 const int button_margin = switches::IsMaterialDesignUserMenu() | 202 const int button_margin = switches::IsMaterialDesignUserMenu() |
| 202 ? kMaterialMenuEdgeMargin | 203 ? kMaterialMenuEdgeMargin |
| 203 : views::kButtonHEdgeMarginNew; | 204 : views::kButtonHEdgeMarginNew; |
| 204 SetBorder(views::CreateEmptyBorder(0, button_margin, 0, button_margin)); | 205 SetBorder(views::CreateEmptyBorder(0, button_margin, 0, button_margin)); |
| 205 SetFocusForPlatform(); | 206 SetFocusForPlatform(); |
| 206 | 207 |
| 207 if (switches::IsMaterialDesignUserMenu()) { | 208 if (switches::IsMaterialDesignUserMenu()) { |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2109 int warning_button_width = 0; | 2110 int warning_button_width = 0; |
| 2110 if (reauth_required) { | 2111 if (reauth_required) { |
| 2111 const int kIconSize = 18; | 2112 const int kIconSize = 18; |
| 2112 warning_default_image = gfx::CreateVectorIcon( | 2113 warning_default_image = gfx::CreateVectorIcon( |
| 2113 gfx::VectorIconId::WARNING, kIconSize, gfx::kChromeIconGrey); | 2114 gfx::VectorIconId::WARNING, kIconSize, gfx::kChromeIconGrey); |
| 2114 warning_button_width = kIconSize + views::kRelatedButtonHSpacing; | 2115 warning_button_width = kIconSize + views::kRelatedButtonHSpacing; |
| 2115 } | 2116 } |
| 2116 int available_width = width - 2 * views::kButtonHEdgeMarginNew - | 2117 int available_width = width - 2 * views::kButtonHEdgeMarginNew - |
| 2117 kDeleteButtonWidth - warning_button_width; | 2118 kDeleteButtonWidth - warning_button_width; |
| 2118 views::LabelButton* email_button = new BackgroundColorHoverButton( | 2119 views::LabelButton* email_button = new BackgroundColorHoverButton( |
| 2119 reauth_required ? this : NULL, | 2120 this, base::UTF8ToUTF16(email), warning_default_image); |
|
Peter Kasting
2017/02/23 01:35:02
Why were we trying to pass null before? Usually t
jlebel
2017/02/23 18:02:57
You are right, I missed a feature related to this
Peter Kasting
2017/02/24 00:51:19
Will disabling the button cause it to draw differe
| |
| 2120 base::UTF8ToUTF16(email), | |
| 2121 warning_default_image); | |
| 2122 email_button->SetElideBehavior(gfx::ELIDE_EMAIL); | 2121 email_button->SetElideBehavior(gfx::ELIDE_EMAIL); |
| 2123 email_button->SetMinSize(gfx::Size(0, kButtonHeight)); | 2122 email_button->SetMinSize(gfx::Size(0, kButtonHeight)); |
| 2124 email_button->SetMaxSize(gfx::Size(available_width, kButtonHeight)); | 2123 email_button->SetMaxSize(gfx::Size(available_width, kButtonHeight)); |
| 2125 layout->StartRow(1, 0); | 2124 layout->StartRow(1, 0); |
| 2126 layout->AddView(email_button); | 2125 layout->AddView(email_button); |
| 2127 | 2126 |
| 2128 if (reauth_required) | 2127 if (reauth_required) |
| 2129 reauth_account_button_map_[email_button] = account_id; | 2128 reauth_account_button_map_[email_button] = account_id; |
| 2130 | 2129 |
| 2131 // Delete button. | 2130 // Delete button. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2380 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2379 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2381 IncognitoModePrefs::DISABLED; | 2380 IncognitoModePrefs::DISABLED; |
| 2382 return incognito_available && !browser_->profile()->IsGuestSession(); | 2381 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2383 } | 2382 } |
| 2384 | 2383 |
| 2385 void ProfileChooserView::PostActionPerformed( | 2384 void ProfileChooserView::PostActionPerformed( |
| 2386 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2385 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2387 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2386 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2388 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2387 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2389 } | 2388 } |
| OLD | NEW |