| 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/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 const base::string16& button_text, | 1095 const base::string16& button_text, |
| 1096 bool stack_button, | 1096 bool stack_button, |
| 1097 views::Link** link, | 1097 views::Link** link, |
| 1098 views::LabelButton** button, | 1098 views::LabelButton** button, |
| 1099 views::ImageButton** close_button) { | 1099 views::ImageButton** close_button) { |
| 1100 tutorial_mode_ = tutorial_mode; | 1100 tutorial_mode_ = tutorial_mode; |
| 1101 | 1101 |
| 1102 views::View* view = new views::View(); | 1102 views::View* view = new views::View(); |
| 1103 view->set_background(views::Background::CreateSolidBackground( | 1103 view->set_background(views::Background::CreateSolidBackground( |
| 1104 profiles::kAvatarTutorialBackgroundColor)); | 1104 profiles::kAvatarTutorialBackgroundColor)); |
| 1105 view->SetBorder(views::CreateEmptyBorder( |
| 1106 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew, |
| 1107 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew)); |
| 1105 views::GridLayout* layout = CreateSingleColumnLayout( | 1108 views::GridLayout* layout = CreateSingleColumnLayout( |
| 1106 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 1109 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
| 1107 // Creates a second column set for buttons and links. | 1110 // Creates a second column set for buttons and links. |
| 1108 views::ColumnSet* button_columns = layout->AddColumnSet(1); | 1111 views::ColumnSet* button_columns = layout->AddColumnSet(1); |
| 1109 button_columns->AddColumn(views::GridLayout::LEADING, | 1112 button_columns->AddColumn(views::GridLayout::LEADING, |
| 1110 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 1113 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
| 1111 button_columns->AddPaddingColumn( | 1114 button_columns->AddPaddingColumn( |
| 1112 1, views::kUnrelatedControlHorizontalSpacing); | 1115 1, views::kUnrelatedControlHorizontalSpacing); |
| 1113 button_columns->AddColumn(views::GridLayout::TRAILING, | 1116 button_columns->AddColumn(views::GridLayout::TRAILING, |
| 1114 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 1117 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
| 1115 layout->SetInsets(views::kButtonVEdgeMarginNew, | |
| 1116 views::kButtonHEdgeMarginNew, | |
| 1117 views::kButtonVEdgeMarginNew, | |
| 1118 views::kButtonHEdgeMarginNew); | |
| 1119 | 1118 |
| 1120 // Adds title and close button if needed. | 1119 // Adds title and close button if needed. |
| 1121 const SkColor kTitleAndButtonTextColor = SK_ColorWHITE; | 1120 const SkColor kTitleAndButtonTextColor = SK_ColorWHITE; |
| 1122 views::Label* title_label = new views::Label(title_text); | 1121 views::Label* title_label = new views::Label(title_text); |
| 1123 title_label->SetMultiLine(true); | 1122 title_label->SetMultiLine(true); |
| 1124 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1123 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1125 title_label->SetAutoColorReadabilityEnabled(false); | 1124 title_label->SetAutoColorReadabilityEnabled(false); |
| 1126 title_label->SetEnabledColor(kTitleAndButtonTextColor); | 1125 title_label->SetEnabledColor(kTitleAndButtonTextColor); |
| 1127 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 1126 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 1128 ui::ResourceBundle::MediumFont)); | 1127 ui::ResourceBundle::MediumFont)); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 | 1552 |
| 1554 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 1553 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); |
| 1555 return view; | 1554 return view; |
| 1556 } | 1555 } |
| 1557 | 1556 |
| 1558 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { | 1557 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { |
| 1559 views::View* view = new views::View(); | 1558 views::View* view = new views::View(); |
| 1560 int horizontal_margin = kMenuEdgeMargin; | 1559 int horizontal_margin = kMenuEdgeMargin; |
| 1561 views::GridLayout* layout = | 1560 views::GridLayout* layout = |
| 1562 CreateSingleColumnLayout(view, kFixedMenuWidth - 2 * horizontal_margin); | 1561 CreateSingleColumnLayout(view, kFixedMenuWidth - 2 * horizontal_margin); |
| 1563 layout->SetInsets(0, horizontal_margin, kMenuEdgeMargin, horizontal_margin); | 1562 view->SetBorder(views::CreateEmptyBorder(0, horizontal_margin, |
| 1563 kMenuEdgeMargin, horizontal_margin)); |
| 1564 | 1564 |
| 1565 views::Label* disclaimer = new views::Label( | 1565 views::Label* disclaimer = new views::Label( |
| 1566 avatar_menu_->GetSupervisedUserInformation()); | 1566 avatar_menu_->GetSupervisedUserInformation()); |
| 1567 disclaimer->SetMultiLine(true); | 1567 disclaimer->SetMultiLine(true); |
| 1568 disclaimer->SetAllowCharacterBreak(true); | 1568 disclaimer->SetAllowCharacterBreak(true); |
| 1569 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1569 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1570 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1570 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 1571 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); | 1571 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); |
| 1572 layout->StartRow(1, 0); | 1572 layout->StartRow(1, 0); |
| 1573 layout->AddView(disclaimer); | 1573 layout->AddView(disclaimer); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 | 1671 |
| 1672 // Save the original email address, as the button text could be elided. | 1672 // Save the original email address, as the button text could be elided. |
| 1673 delete_account_button_map_[delete_button] = account_id; | 1673 delete_account_button_map_[delete_button] = account_id; |
| 1674 } | 1674 } |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 views::View* ProfileChooserView::CreateAccountRemovalView() { | 1677 views::View* ProfileChooserView::CreateAccountRemovalView() { |
| 1678 views::View* view = new views::View(); | 1678 views::View* view = new views::View(); |
| 1679 views::GridLayout* layout = CreateSingleColumnLayout( | 1679 views::GridLayout* layout = CreateSingleColumnLayout( |
| 1680 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); | 1680 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); |
| 1681 layout->SetInsets(0, | 1681 view->SetBorder(views::CreateEmptyBorder(0, views::kButtonHEdgeMarginNew, |
| 1682 views::kButtonHEdgeMarginNew, | 1682 views::kButtonVEdgeMarginNew, |
| 1683 views::kButtonVEdgeMarginNew, | 1683 views::kButtonHEdgeMarginNew)); |
| 1684 views::kButtonHEdgeMarginNew); | |
| 1685 | 1684 |
| 1686 const std::string& primary_account = SigninManagerFactory::GetForProfile( | 1685 const std::string& primary_account = SigninManagerFactory::GetForProfile( |
| 1687 browser_->profile())->GetAuthenticatedAccountId(); | 1686 browser_->profile())->GetAuthenticatedAccountId(); |
| 1688 bool is_primary_account = primary_account == account_id_to_remove_; | 1687 bool is_primary_account = primary_account == account_id_to_remove_; |
| 1689 | 1688 |
| 1690 // Adds main text. | 1689 // Adds main text. |
| 1691 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1690 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
| 1692 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1691 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 1693 const gfx::FontList& small_font_list = | 1692 const gfx::FontList& small_font_list = |
| 1694 rb->GetFontList(ui::ResourceBundle::SmallFont); | 1693 rb->GetFontList(ui::ResourceBundle::SmallFont); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1854 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1856 IncognitoModePrefs::DISABLED; | 1855 IncognitoModePrefs::DISABLED; |
| 1857 return incognito_available && !browser_->profile()->IsGuestSession(); | 1856 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1858 } | 1857 } |
| 1859 | 1858 |
| 1860 void ProfileChooserView::PostActionPerformed( | 1859 void ProfileChooserView::PostActionPerformed( |
| 1861 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1860 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1862 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1861 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1863 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1862 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1864 } | 1863 } |
| OLD | NEW |