| 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 void ProfileChooserView::DismissTutorial() { | 1058 void ProfileChooserView::DismissTutorial() { |
| 1059 // Never shows the upgrade tutorial again if manually closed. | 1059 // Never shows the upgrade tutorial again if manually closed. |
| 1060 if (tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { | 1060 if (tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
| 1061 browser_->profile()->GetPrefs()->SetInteger( | 1061 browser_->profile()->GetPrefs()->SetInteger( |
| 1062 prefs::kProfileAvatarTutorialShown, | 1062 prefs::kProfileAvatarTutorialShown, |
| 1063 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); | 1063 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 if (tutorial_mode_ == profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING) { | |
| 1067 PrefService* local_state = g_browser_process->local_state(); | |
| 1068 local_state->SetBoolean( | |
| 1069 prefs::kProfileAvatarRightClickTutorialDismissed, true); | |
| 1070 } | |
| 1071 | |
| 1072 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; | 1066 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
| 1073 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER); | 1067 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER); |
| 1074 } | 1068 } |
| 1075 | 1069 |
| 1076 views::View* ProfileChooserView::CreateTutorialViewIfNeeded( | 1070 views::View* ProfileChooserView::CreateTutorialViewIfNeeded( |
| 1077 const AvatarMenu::Item& item) { | 1071 const AvatarMenu::Item& item) { |
| 1078 if (tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) | 1072 if (tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) |
| 1079 return CreateSigninConfirmationView(); | 1073 return CreateSigninConfirmationView(); |
| 1080 | 1074 |
| 1081 if (tutorial_mode_ == profiles::TUTORIAL_MODE_SHOW_ERROR) | 1075 if (tutorial_mode_ == profiles::TUTORIAL_MODE_SHOW_ERROR) |
| 1082 return CreateSigninErrorView(); | 1076 return CreateSigninErrorView(); |
| 1083 | 1077 |
| 1084 if (profiles::ShouldShowWelcomeUpgradeTutorial( | 1078 if (profiles::ShouldShowWelcomeUpgradeTutorial( |
| 1085 browser_->profile(), tutorial_mode_)) { | 1079 browser_->profile(), tutorial_mode_)) { |
| 1086 if (tutorial_mode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { | 1080 if (tutorial_mode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
| 1087 Profile* profile = browser_->profile(); | 1081 Profile* profile = browser_->profile(); |
| 1088 const int show_count = profile->GetPrefs()->GetInteger( | 1082 const int show_count = profile->GetPrefs()->GetInteger( |
| 1089 prefs::kProfileAvatarTutorialShown); | 1083 prefs::kProfileAvatarTutorialShown); |
| 1090 profile->GetPrefs()->SetInteger( | 1084 profile->GetPrefs()->SetInteger( |
| 1091 prefs::kProfileAvatarTutorialShown, show_count + 1); | 1085 prefs::kProfileAvatarTutorialShown, show_count + 1); |
| 1092 } | 1086 } |
| 1093 | 1087 |
| 1094 return CreateWelcomeUpgradeTutorialView(item); | 1088 return CreateWelcomeUpgradeTutorialView(item); |
| 1095 } | 1089 } |
| 1096 | 1090 |
| 1097 if (profiles::ShouldShowRightClickTutorial(browser_->profile())) | |
| 1098 return CreateRightClickTutorialView(); | |
| 1099 | |
| 1100 return nullptr; | 1091 return nullptr; |
| 1101 } | 1092 } |
| 1102 | 1093 |
| 1103 views::View* ProfileChooserView::CreateTutorialView( | 1094 views::View* ProfileChooserView::CreateTutorialView( |
| 1104 profiles::TutorialMode tutorial_mode, | 1095 profiles::TutorialMode tutorial_mode, |
| 1105 const base::string16& title_text, | 1096 const base::string16& title_text, |
| 1106 const base::string16& content_text, | 1097 const base::string16& content_text, |
| 1107 const base::string16& link_text, | 1098 const base::string16& link_text, |
| 1108 const base::string16& button_text, | 1099 const base::string16& button_text, |
| 1109 bool stack_button, | 1100 bool stack_button, |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 l10n_util::GetStringUTF16(IDS_PROFILES_ERROR_TUTORIAL_TITLE), | 1825 l10n_util::GetStringUTF16(IDS_PROFILES_ERROR_TUTORIAL_TITLE), |
| 1835 last_login_result, | 1826 last_login_result, |
| 1836 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), | 1827 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), |
| 1837 base::string16(), | 1828 base::string16(), |
| 1838 false /* stack_button */, | 1829 false /* stack_button */, |
| 1839 &tutorial_learn_more_link_, | 1830 &tutorial_learn_more_link_, |
| 1840 NULL, | 1831 NULL, |
| 1841 &tutorial_close_button_); | 1832 &tutorial_close_button_); |
| 1842 } | 1833 } |
| 1843 | 1834 |
| 1844 views::View* ProfileChooserView::CreateRightClickTutorialView() { | |
| 1845 return CreateTutorialView( | |
| 1846 profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING, | |
| 1847 l10n_util::GetStringUTF16(IDS_PROFILES_RIGHT_CLICK_TUTORIAL_TITLE), | |
| 1848 l10n_util::GetStringUTF16(IDS_PROFILES_RIGHT_CLICK_TUTORIAL_CONTENT_TEXT), | |
| 1849 base::string16(), | |
| 1850 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), | |
| 1851 false, | |
| 1852 nullptr, | |
| 1853 &tutorial_sync_settings_ok_button_, | |
| 1854 nullptr); | |
| 1855 } | |
| 1856 | |
| 1857 views::View* ProfileChooserView::CreateSwitchUserView() { | 1835 views::View* ProfileChooserView::CreateSwitchUserView() { |
| 1858 views::View* view = new views::View(); | 1836 views::View* view = new views::View(); |
| 1859 views::GridLayout* layout = CreateSingleColumnLayout( | 1837 views::GridLayout* layout = CreateSingleColumnLayout( |
| 1860 view, kFixedSwitchUserViewWidth); | 1838 view, kFixedSwitchUserViewWidth); |
| 1861 views::ColumnSet* columns = layout->AddColumnSet(1); | 1839 views::ColumnSet* columns = layout->AddColumnSet(1); |
| 1862 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); | 1840 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| 1863 int label_width = | 1841 int label_width = |
| 1864 kFixedSwitchUserViewWidth - 2 * views::kButtonHEdgeMarginNew; | 1842 kFixedSwitchUserViewWidth - 2 * views::kButtonHEdgeMarginNew; |
| 1865 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | 1843 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
| 1866 views::GridLayout::FIXED, label_width, label_width); | 1844 views::GridLayout::FIXED, label_width, label_width); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1892 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1915 IncognitoModePrefs::DISABLED; | 1893 IncognitoModePrefs::DISABLED; |
| 1916 return incognito_available && !browser_->profile()->IsGuestSession(); | 1894 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1917 } | 1895 } |
| 1918 | 1896 |
| 1919 void ProfileChooserView::PostActionPerformed( | 1897 void ProfileChooserView::PostActionPerformed( |
| 1920 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1898 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1921 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1899 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1922 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1900 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1923 } | 1901 } |
| OLD | NEW |