| 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 void ProfileChooserView::ResetView() { | 692 void ProfileChooserView::ResetView() { |
| 693 open_other_profile_indexes_map_.clear(); | 693 open_other_profile_indexes_map_.clear(); |
| 694 delete_account_button_map_.clear(); | 694 delete_account_button_map_.clear(); |
| 695 reauth_account_button_map_.clear(); | 695 reauth_account_button_map_.clear(); |
| 696 manage_accounts_link_ = NULL; | 696 manage_accounts_link_ = NULL; |
| 697 signin_current_profile_link_ = NULL; | 697 signin_current_profile_link_ = NULL; |
| 698 auth_error_email_button_ = NULL; | 698 auth_error_email_button_ = NULL; |
| 699 current_profile_photo_ = NULL; | 699 current_profile_photo_ = NULL; |
| 700 current_profile_name_ = NULL; | 700 current_profile_name_ = NULL; |
| 701 users_button_ = NULL; | 701 users_button_ = NULL; |
| 702 go_incognito_button_ = NULL; |
| 702 lock_button_ = NULL; | 703 lock_button_ = NULL; |
| 703 add_account_link_ = NULL; | 704 add_account_link_ = NULL; |
| 704 gaia_signin_cancel_button_ = NULL; | 705 gaia_signin_cancel_button_ = NULL; |
| 705 remove_account_button_ = NULL; | 706 remove_account_button_ = NULL; |
| 706 account_removal_cancel_button_ = NULL; | 707 account_removal_cancel_button_ = NULL; |
| 707 add_person_button_ = NULL; | 708 add_person_button_ = NULL; |
| 708 disconnect_button_ = NULL; | 709 disconnect_button_ = NULL; |
| 709 switch_user_cancel_button_ = NULL; | 710 switch_user_cancel_button_ = NULL; |
| 710 tutorial_sync_settings_ok_button_ = NULL; | 711 tutorial_sync_settings_ok_button_ = NULL; |
| 711 tutorial_close_button_ = NULL; | 712 tutorial_close_button_ = NULL; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 if (sender == users_button_) { | 905 if (sender == users_button_) { |
| 905 // If this is a guest session, close all the guest browser windows. | 906 // If this is a guest session, close all the guest browser windows. |
| 906 if (browser_->profile()->IsGuestSession()) { | 907 if (browser_->profile()->IsGuestSession()) { |
| 907 profiles::CloseGuestProfileWindows(); | 908 profiles::CloseGuestProfileWindows(); |
| 908 } else { | 909 } else { |
| 909 UserManager::Show(base::FilePath(), | 910 UserManager::Show(base::FilePath(), |
| 910 profiles::USER_MANAGER_NO_TUTORIAL, | 911 profiles::USER_MANAGER_NO_TUTORIAL, |
| 911 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 912 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 912 } | 913 } |
| 913 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); | 914 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); |
| 915 } else if (sender == go_incognito_button_) { |
| 916 DCHECK(ShouldShowGoIncognito()); |
| 917 chrome::NewIncognitoWindow(browser_); |
| 918 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO); |
| 914 } else if (sender == lock_button_) { | 919 } else if (sender == lock_button_) { |
| 915 profiles::LockProfile(browser_->profile()); | 920 profiles::LockProfile(browser_->profile()); |
| 916 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 921 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
| 917 } else if (sender == auth_error_email_button_) { | 922 } else if (sender == auth_error_email_button_) { |
| 918 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); | 923 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); |
| 919 } else if (sender == tutorial_sync_settings_ok_button_) { | 924 } else if (sender == tutorial_sync_settings_ok_button_) { |
| 920 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 925 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 921 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); | 926 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); |
| 922 DismissTutorial(); | 927 DismissTutorial(); |
| 923 ProfileMetrics::LogProfileNewAvatarMenuSignin( | 928 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 | 1494 |
| 1490 return view; | 1495 return view; |
| 1491 } | 1496 } |
| 1492 | 1497 |
| 1493 views::View* ProfileChooserView::CreateOptionsView(bool display_lock) { | 1498 views::View* ProfileChooserView::CreateOptionsView(bool display_lock) { |
| 1494 views::View* view = new views::View(); | 1499 views::View* view = new views::View(); |
| 1495 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); | 1500 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); |
| 1496 | 1501 |
| 1497 base::string16 text = browser_->profile()->IsGuestSession() ? | 1502 base::string16 text = browser_->profile()->IsGuestSession() ? |
| 1498 l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) : | 1503 l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) : |
| 1499 l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON); | 1504 l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON); |
| 1505 if (!browser_->profile()->IsGuestSession() |
| 1506 && switches::IsMaterialDesignUserMenu()) { |
| 1507 text = l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON); |
| 1508 } |
| 1500 const int kIconSize = 16; | 1509 const int kIconSize = 16; |
| 1501 users_button_ = new BackgroundColorHoverButton( | 1510 users_button_ = new BackgroundColorHoverButton( |
| 1502 this, text, gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_BOX, | 1511 this, text, gfx::CreateVectorIcon(gfx::VectorIconId::ACCOUNT_BOX, |
| 1503 kIconSize, gfx::kChromeIconGrey)); | 1512 kIconSize, gfx::kChromeIconGrey)); |
| 1504 layout->StartRow(1, 0); | 1513 layout->StartRow(1, 0); |
| 1505 layout->AddView(users_button_); | 1514 layout->AddView(users_button_); |
| 1506 | 1515 |
| 1516 if (!switches::IsMaterialDesignUserMenu() && ShouldShowGoIncognito()) { |
| 1517 layout->StartRow(1, 0); |
| 1518 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 1519 |
| 1520 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 1521 go_incognito_button_ = new BackgroundColorHoverButton( |
| 1522 this, |
| 1523 l10n_util::GetStringUTF16(IDS_PROFILES_GO_INCOGNITO_BUTTON), |
| 1524 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_INCOGNITO)); |
| 1525 layout->StartRow(1, 0); |
| 1526 layout->AddView(go_incognito_button_); |
| 1527 } |
| 1528 |
| 1507 if (display_lock) { | 1529 if (display_lock) { |
| 1508 layout->StartRow(1, 0); | 1530 layout->StartRow(1, 0); |
| 1509 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1531 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 1510 | 1532 |
| 1511 lock_button_ = new BackgroundColorHoverButton( | 1533 lock_button_ = new BackgroundColorHoverButton( |
| 1512 this, l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), | 1534 this, l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), |
| 1513 gfx::CreateVectorIcon(gfx::VectorIconId::LOCK, kIconSize, | 1535 gfx::CreateVectorIcon(gfx::VectorIconId::LOCK, kIconSize, |
| 1514 gfx::kChromeIconGrey)); | 1536 gfx::kChromeIconGrey)); |
| 1515 layout->StartRow(1, 0); | 1537 layout->StartRow(1, 0); |
| 1516 layout->AddView(lock_button_); | 1538 layout->AddView(lock_button_); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1890 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1869 IncognitoModePrefs::DISABLED; | 1891 IncognitoModePrefs::DISABLED; |
| 1870 return incognito_available && !browser_->profile()->IsGuestSession(); | 1892 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1871 } | 1893 } |
| 1872 | 1894 |
| 1873 void ProfileChooserView::PostActionPerformed( | 1895 void ProfileChooserView::PostActionPerformed( |
| 1874 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1896 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1875 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1897 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1876 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1898 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1877 } | 1899 } |
| OLD | NEW |