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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1487 sync_ui_util::AvatarSyncErrorType error = | 1487 sync_ui_util::AvatarSyncErrorType error = |
| 1488 sync_ui_util::GetMessagesForAvatarSyncError( | 1488 sync_ui_util::GetMessagesForAvatarSyncError( |
| 1489 browser_->profile(), &content_string_id, &button_string_id); | 1489 browser_->profile(), &content_string_id, &button_string_id); |
| 1490 switch (error) { | 1490 switch (error) { |
| 1491 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: | 1491 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: |
| 1492 button_out = &sync_error_signout_button_; | 1492 button_out = &sync_error_signout_button_; |
| 1493 break; | 1493 break; |
| 1494 case sync_ui_util::UNRECOVERABLE_ERROR: | 1494 case sync_ui_util::UNRECOVERABLE_ERROR: |
| 1495 button_out = &sync_error_signin_again_button_; | 1495 button_out = &sync_error_signin_again_button_; |
| 1496 break; | 1496 break; |
| 1497 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: | |
| 1498 break; | |
| 1497 case sync_ui_util::AUTH_ERROR: | 1499 case sync_ui_util::AUTH_ERROR: |
| 1498 button_out = &sync_error_signin_button_; | 1500 button_out = &sync_error_signin_button_; |
| 1499 break; | 1501 break; |
| 1500 case sync_ui_util::UPGRADE_CLIENT_ERROR: | 1502 case sync_ui_util::UPGRADE_CLIENT_ERROR: |
| 1501 button_out = &sync_error_upgrade_button_; | 1503 button_out = &sync_error_upgrade_button_; |
| 1502 break; | 1504 break; |
| 1503 case sync_ui_util::PASSPHRASE_ERROR: | 1505 case sync_ui_util::PASSPHRASE_ERROR: |
| 1504 button_out = &sync_error_passphrase_button_; | 1506 button_out = &sync_error_passphrase_button_; |
| 1505 break; | 1507 break; |
| 1506 case sync_ui_util::NO_SYNC_ERROR: | 1508 case sync_ui_util::NO_SYNC_ERROR: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1546 title_label->SetEnabledColor(gfx::kGoogleRed700); | 1548 title_label->SetEnabledColor(gfx::kGoogleRed700); |
| 1547 vertical_view->AddChildView(title_label); | 1549 vertical_view->AddChildView(title_label); |
| 1548 | 1550 |
| 1549 // Adds body content. | 1551 // Adds body content. |
| 1550 views::Label* content_label = | 1552 views::Label* content_label = |
| 1551 new views::Label(l10n_util::GetStringUTF16(content_string_id)); | 1553 new views::Label(l10n_util::GetStringUTF16(content_string_id)); |
| 1552 content_label->SetMultiLine(true); | 1554 content_label->SetMultiLine(true); |
| 1553 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1555 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1554 vertical_view->AddChildView(content_label); | 1556 vertical_view->AddChildView(content_label); |
| 1555 | 1557 |
| 1556 // Adds a padding row between error title/content and the button. | 1558 // Adds an action button. |
| 1557 SizedContainer* padding = | 1559 if (button_string_id) { |
| 1558 new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); | 1560 DCHECK(button_out); |
| 1559 vertical_view->AddChildView(padding); | 1561 // Adds a padding row between error title/content and the button. |
| 1562 SizedContainer* padding = | |
| 1563 new SizedContainer(gfx::Size(0, views::kRelatedControlVerticalSpacing)); | |
| 1564 vertical_view->AddChildView(padding); | |
| 1560 | 1565 |
| 1561 // Adds an action button. | 1566 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( |
| 1562 *button_out = views::MdTextButton::CreateSecondaryUiBlueButton( | 1567 this, l10n_util::GetStringUTF16(button_string_id)); |
| 1563 this, l10n_util::GetStringUTF16(button_string_id)); | 1568 vertical_view->AddChildView(*button_out); |
| 1564 vertical_view->AddChildView(*button_out); | 1569 view->SetBorder(views::Border::CreateEmptyBorder( |
| 1570 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); | |
| 1571 } | |
|
sky
2016/08/22 20:43:22
Can you set button_out to null in the else case to
Jane
2016/08/22 21:05:15
Done.
| |
| 1565 | 1572 |
| 1566 view->AddChildView(vertical_view); | 1573 view->AddChildView(vertical_view); |
| 1567 view->SetBorder(views::Border::CreateEmptyBorder( | |
| 1568 0, 0, views::kRelatedControlSmallVerticalSpacing, 0)); | |
| 1569 | |
| 1570 return view; | 1574 return view; |
| 1571 } | 1575 } |
| 1572 | 1576 |
| 1573 views::View* ProfileChooserView::CreateCurrentProfileView( | 1577 views::View* ProfileChooserView::CreateCurrentProfileView( |
| 1574 const AvatarMenu::Item& avatar_item, | 1578 const AvatarMenu::Item& avatar_item, |
| 1575 bool is_guest) { | 1579 bool is_guest) { |
| 1576 views::View* view = new views::View(); | 1580 views::View* view = new views::View(); |
| 1577 int column_width = GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew; | 1581 int column_width = GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew; |
| 1578 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); | 1582 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); |
| 1579 layout->SetInsets(views::kButtonVEdgeMarginNew, | 1583 layout->SetInsets(views::kButtonVEdgeMarginNew, |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2299 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2303 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2300 IncognitoModePrefs::DISABLED; | 2304 IncognitoModePrefs::DISABLED; |
| 2301 return incognito_available && !browser_->profile()->IsGuestSession(); | 2305 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2302 } | 2306 } |
| 2303 | 2307 |
| 2304 void ProfileChooserView::PostActionPerformed( | 2308 void ProfileChooserView::PostActionPerformed( |
| 2305 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2309 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2306 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2310 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2307 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2311 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2308 } | 2312 } |
| OLD | NEW |