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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 sync_ui_util::AvatarSyncErrorType error = | 1491 sync_ui_util::AvatarSyncErrorType error = |
| 1492 sync_ui_util::GetMessagesForAvatarSyncError( | 1492 sync_ui_util::GetMessagesForAvatarSyncError( |
| 1493 browser_->profile(), &content_string_id, &button_string_id); | 1493 browser_->profile(), &content_string_id, &button_string_id); |
| 1494 switch (error) { | 1494 switch (error) { |
| 1495 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: | 1495 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: |
| 1496 button_out = &sync_error_signout_button_; | 1496 button_out = &sync_error_signout_button_; |
| 1497 break; | 1497 break; |
| 1498 case sync_ui_util::UNRECOVERABLE_ERROR: | 1498 case sync_ui_util::UNRECOVERABLE_ERROR: |
| 1499 button_out = &sync_error_signin_again_button_; | 1499 button_out = &sync_error_signin_again_button_; |
| 1500 break; | 1500 break; |
| 1501 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: | |
| 1502 button_out = nullptr; | |
| 1503 break; | |
| 1501 case sync_ui_util::AUTH_ERROR: | 1504 case sync_ui_util::AUTH_ERROR: |
| 1502 button_out = &sync_error_signin_button_; | 1505 button_out = &sync_error_signin_button_; |
| 1503 break; | 1506 break; |
| 1504 case sync_ui_util::UPGRADE_CLIENT_ERROR: | 1507 case sync_ui_util::UPGRADE_CLIENT_ERROR: |
| 1505 button_out = &sync_error_upgrade_button_; | 1508 button_out = &sync_error_upgrade_button_; |
| 1506 break; | 1509 break; |
| 1507 case sync_ui_util::PASSPHRASE_ERROR: | 1510 case sync_ui_util::PASSPHRASE_ERROR: |
| 1508 button_out = &sync_error_passphrase_button_; | 1511 button_out = &sync_error_passphrase_button_; |
| 1509 break; | 1512 break; |
| 1510 case sync_ui_util::NO_SYNC_ERROR: | 1513 case sync_ui_util::NO_SYNC_ERROR: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1550 title_label->SetEnabledColor(gfx::kGoogleRed700); | 1553 title_label->SetEnabledColor(gfx::kGoogleRed700); |
| 1551 vertical_view->AddChildView(title_label); | 1554 vertical_view->AddChildView(title_label); |
| 1552 | 1555 |
| 1553 // Adds body content. | 1556 // Adds body content. |
| 1554 views::Label* content_label = | 1557 views::Label* content_label = |
| 1555 new views::Label(l10n_util::GetStringUTF16(content_string_id)); | 1558 new views::Label(l10n_util::GetStringUTF16(content_string_id)); |
| 1556 content_label->SetMultiLine(true); | 1559 content_label->SetMultiLine(true); |
| 1557 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1560 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1558 vertical_view->AddChildView(content_label); | 1561 vertical_view->AddChildView(content_label); |
| 1559 | 1562 |
| 1560 // Adds a padding row between error title/content and the button. | 1563 // Adds an action button if an action exists. |
| 1561 SizedContainer* padding = | 1564 if (button_string_id) { |
| 1562 new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); | 1565 DCHECK(button_out); |
| 1563 vertical_view->AddChildView(padding); | 1566 // Adds a padding row between error title/content and the button. |
| 1567 SizedContainer* padding = | |
| 1568 new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); | |
| 1569 vertical_view->AddChildView(padding); | |
| 1564 | 1570 |
| 1565 // Adds an action button. | 1571 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( |
| 1566 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( | 1572 this, l10n_util::GetStringUTF16(button_string_id)); |
| 1567 this, l10n_util::GetStringUTF16(button_string_id)); | 1573 vertical_view->AddChildView(*button_out); |
| 1568 vertical_view->AddChildView(*button_out); | 1574 view->SetBorder(views::Border::CreateEmptyBorder( |
| 1575 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); | |
| 1576 } else { | |
| 1577 button_out = nullptr; | |
|
sky
2016/08/22 23:16:42
*button_out = nullptr;
A better idea is likely to
Jane
2016/08/23 00:28:07
Done. Do you just mean merging them like this? I c
| |
| 1578 } | |
| 1569 | 1579 |
| 1570 view->AddChildView(vertical_view); | 1580 view->AddChildView(vertical_view); |
| 1571 view->SetBorder(views::Border::CreateEmptyBorder( | |
| 1572 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); | |
| 1573 | |
| 1574 return view; | 1581 return view; |
| 1575 } | 1582 } |
| 1576 | 1583 |
| 1577 views::View* ProfileChooserView::CreateCurrentProfileView( | 1584 views::View* ProfileChooserView::CreateCurrentProfileView( |
| 1578 const AvatarMenu::Item& avatar_item, | 1585 const AvatarMenu::Item& avatar_item, |
| 1579 bool is_guest) { | 1586 bool is_guest) { |
| 1580 views::View* view = new views::View(); | 1587 views::View* view = new views::View(); |
| 1581 int column_width = GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew; | 1588 int column_width = GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew; |
| 1582 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); | 1589 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); |
| 1583 layout->SetInsets(views::kButtonVEdgeMarginNew, | 1590 layout->SetInsets(views::kButtonVEdgeMarginNew, |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2303 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2310 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2304 IncognitoModePrefs::DISABLED; | 2311 IncognitoModePrefs::DISABLED; |
| 2305 return incognito_available && !browser_->profile()->IsGuestSession(); | 2312 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2306 } | 2313 } |
| 2307 | 2314 |
| 2308 void ProfileChooserView::PostActionPerformed( | 2315 void ProfileChooserView::PostActionPerformed( |
| 2309 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2316 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2310 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2317 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2311 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2318 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2312 } | 2319 } |
| OLD | NEW |