| 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 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 int warning_button_width = 0; | 2127 int warning_button_width = 0; |
| 2127 if (reauth_required) { | 2128 if (reauth_required) { |
| 2128 const int kIconSize = 18; | 2129 const int kIconSize = 18; |
| 2129 warning_default_image = gfx::CreateVectorIcon( | 2130 warning_default_image = gfx::CreateVectorIcon( |
| 2130 gfx::VectorIconId::WARNING, kIconSize, gfx::kChromeIconGrey); | 2131 gfx::VectorIconId::WARNING, kIconSize, gfx::kChromeIconGrey); |
| 2131 warning_button_width = kIconSize + views::kRelatedButtonHSpacing; | 2132 warning_button_width = kIconSize + views::kRelatedButtonHSpacing; |
| 2132 } | 2133 } |
| 2133 int available_width = width - 2 * views::kButtonHEdgeMarginNew - | 2134 int available_width = width - 2 * views::kButtonHEdgeMarginNew - |
| 2134 kDeleteButtonWidth - warning_button_width; | 2135 kDeleteButtonWidth - warning_button_width; |
| 2135 views::LabelButton* email_button = new BackgroundColorHoverButton( | 2136 views::LabelButton* email_button = new BackgroundColorHoverButton( |
| 2136 reauth_required ? this : NULL, | 2137 this, base::UTF8ToUTF16(email), warning_default_image); |
| 2137 base::UTF8ToUTF16(email), | 2138 email_button->SetEnabled(reauth_required); |
| 2138 warning_default_image); | |
| 2139 email_button->SetElideBehavior(gfx::ELIDE_EMAIL); | 2139 email_button->SetElideBehavior(gfx::ELIDE_EMAIL); |
| 2140 email_button->SetMinSize(gfx::Size(0, kButtonHeight)); | 2140 email_button->SetMinSize(gfx::Size(0, kButtonHeight)); |
| 2141 email_button->SetMaxSize(gfx::Size(available_width, kButtonHeight)); | 2141 email_button->SetMaxSize(gfx::Size(available_width, kButtonHeight)); |
| 2142 layout->StartRow(1, 0); | 2142 layout->StartRow(1, 0); |
| 2143 layout->AddView(email_button); | 2143 layout->AddView(email_button); |
| 2144 | 2144 |
| 2145 if (reauth_required) | 2145 if (reauth_required) |
| 2146 reauth_account_button_map_[email_button] = account_id; | 2146 reauth_account_button_map_[email_button] = account_id; |
| 2147 | 2147 |
| 2148 // Delete button. | 2148 // Delete button. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2397 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2398 IncognitoModePrefs::DISABLED; | 2398 IncognitoModePrefs::DISABLED; |
| 2399 return incognito_available && !browser_->profile()->IsGuestSession(); | 2399 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2400 } | 2400 } |
| 2401 | 2401 |
| 2402 void ProfileChooserView::PostActionPerformed( | 2402 void ProfileChooserView::PostActionPerformed( |
| 2403 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2403 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2404 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2404 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2405 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2405 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2406 } | 2406 } |
| OLD | NEW |