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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 // Separate items into active and alternatives. | 880 // Separate items into active and alternatives. |
881 Indexes other_profiles; | 881 Indexes other_profiles; |
882 views::View* tutorial_view = NULL; | 882 views::View* tutorial_view = NULL; |
883 views::View* current_profile_view = NULL; | 883 views::View* current_profile_view = NULL; |
884 views::View* current_profile_accounts = NULL; | 884 views::View* current_profile_accounts = NULL; |
885 views::View* option_buttons_view = NULL; | 885 views::View* option_buttons_view = NULL; |
886 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { | 886 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { |
887 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); | 887 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); |
888 if (item.active) { | 888 if (item.active) { |
889 option_buttons_view = CreateOptionsView( | 889 option_buttons_view = CreateOptionsView( |
890 switches::IsNewProfileManagement() && item.signed_in); | 890 switches::IsNewProfileManagement() && item.signed_in && |
891 browser_->profile()->GetPrefs()->GetBoolean( | |
892 prefs::kProfileIsLockable)); | |
891 current_profile_view = CreateCurrentProfileView(item, false); | 893 current_profile_view = CreateCurrentProfileView(item, false); |
892 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { | 894 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
893 switch (tutorial_mode_) { | 895 switch (tutorial_mode_) { |
894 case profiles::TUTORIAL_MODE_NONE: | 896 case profiles::TUTORIAL_MODE_NONE: |
895 case profiles::TUTORIAL_MODE_WELCOME_UPGRADE: | 897 case profiles::TUTORIAL_MODE_WELCOME_UPGRADE: |
896 tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded( | 898 tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded( |
897 tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE, | 899 tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE, |
898 item); | 900 item); |
899 break; | 901 break; |
900 case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN: | 902 case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN: |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1268 } | 1270 } |
1269 | 1271 |
1270 if (display_lock) { | 1272 if (display_lock) { |
1271 layout->StartRow(1, 0); | 1273 layout->StartRow(1, 0); |
1272 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1274 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
1273 | 1275 |
1274 lock_button_ = new BackgroundColorHoverButton( | 1276 lock_button_ = new BackgroundColorHoverButton( |
1275 this, | 1277 this, |
1276 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), | 1278 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON), |
1277 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK)); | 1279 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_LOCK)); |
1280 | |
1281 if (!browser_->profile()->GetPrefs()->GetBoolean( | |
1282 prefs::kProfileIsLockable)) { | |
noms (inactive)
2014/09/17 19:12:06
nit: wrong indent
Mike Lerman
2014/09/17 19:45:36
I should just start using git cl format.
| |
1283 lock_button_->SetState(views::Button::STATE_DISABLED); | |
1284 } | |
1285 | |
1278 layout->StartRow(1, 0); | 1286 layout->StartRow(1, 0); |
1279 layout->AddView(lock_button_); | 1287 layout->AddView(lock_button_); |
1280 } | 1288 } |
1281 return view; | 1289 return view; |
1282 } | 1290 } |
1283 | 1291 |
1284 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { | 1292 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { |
1285 views::View* view = new views::View(); | 1293 views::View* view = new views::View(); |
1286 views::GridLayout* layout = CreateSingleColumnLayout( | 1294 views::GridLayout* layout = CreateSingleColumnLayout( |
1287 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 1295 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1638 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1646 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1639 IncognitoModePrefs::DISABLED; | 1647 IncognitoModePrefs::DISABLED; |
1640 return incognito_available && !browser_->profile()->IsGuestSession(); | 1648 return incognito_available && !browser_->profile()->IsGuestSession(); |
1641 } | 1649 } |
1642 | 1650 |
1643 void ProfileChooserView::PostActionPerformed( | 1651 void ProfileChooserView::PostActionPerformed( |
1644 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1652 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1645 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1653 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1646 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1654 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1647 } | 1655 } |
OLD | NEW |