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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 base::string16 new_profile_name = name_textfield->text(); | 767 base::string16 new_profile_name = name_textfield->text(); |
768 if (new_profile_name.empty()) | 768 if (new_profile_name.empty()) |
769 return true; | 769 return true; |
770 | 770 |
771 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( | 771 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( |
772 avatar_menu_->GetActiveProfileIndex()); | 772 avatar_menu_->GetActiveProfileIndex()); |
773 Profile* profile = g_browser_process->profile_manager()->GetProfile( | 773 Profile* profile = g_browser_process->profile_manager()->GetProfile( |
774 active_item.profile_path); | 774 active_item.profile_path); |
775 DCHECK(profile); | 775 DCHECK(profile); |
776 | 776 |
777 if (profile->IsManaged()) | 777 if (profile->IsSupervised()) |
778 return true; | 778 return true; |
779 | 779 |
780 profiles::UpdateProfileName(profile, new_profile_name); | 780 profiles::UpdateProfileName(profile, new_profile_name); |
781 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME); | 781 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME); |
782 current_profile_name_->ShowReadOnlyView(); | 782 current_profile_name_->ShowReadOnlyView(); |
783 return true; | 783 return true; |
784 } | 784 } |
785 return false; | 785 return false; |
786 } | 786 } |
787 | 787 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 842 |
843 if (!current_profile_view) { | 843 if (!current_profile_view) { |
844 // Guest windows don't have an active profile. | 844 // Guest windows don't have an active profile. |
845 current_profile_view = CreateGuestProfileView(); | 845 current_profile_view = CreateGuestProfileView(); |
846 option_buttons_view = CreateOptionsView(false); | 846 option_buttons_view = CreateOptionsView(false); |
847 } | 847 } |
848 | 848 |
849 layout->StartRow(1, 0); | 849 layout->StartRow(1, 0); |
850 layout->AddView(current_profile_view); | 850 layout->AddView(current_profile_view); |
851 | 851 |
852 if (browser_->profile()->IsManaged()) { | 852 if (browser_->profile()->IsSupervised()) { |
853 layout->StartRow(0, 0); | 853 layout->StartRow(0, 0); |
854 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 854 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
855 layout->StartRow(1, 0); | 855 layout->StartRow(1, 0); |
856 layout->AddView(CreateSupervisedUserDisclaimerView()); | 856 layout->AddView(CreateSupervisedUserDisclaimerView()); |
857 } | 857 } |
858 | 858 |
859 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { | 859 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
860 layout->StartRow(1, 0); | 860 layout->StartRow(1, 0); |
861 if (switches::IsFastUserSwitching()) | 861 if (switches::IsFastUserSwitching()) |
862 layout->AddView(CreateOtherProfilesView(other_profiles)); | 862 layout->AddView(CreateOtherProfilesView(other_profiles)); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 question_mark_button_->SetImage(views::ImageButton::STATE_HOVERED, | 1044 question_mark_button_->SetImage(views::ImageButton::STATE_HOVERED, |
1045 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_HOVER)); | 1045 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_HOVER)); |
1046 question_mark_button_->SetImage(views::ImageButton::STATE_PRESSED, | 1046 question_mark_button_->SetImage(views::ImageButton::STATE_PRESSED, |
1047 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_SELECT)); | 1047 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_SELECT)); |
1048 gfx::Size preferred_size = question_mark_button_->GetPreferredSize(); | 1048 gfx::Size preferred_size = question_mark_button_->GetPreferredSize(); |
1049 question_mark_button_->SetBounds( | 1049 question_mark_button_->SetBounds( |
1050 0, 0, preferred_size.width(), preferred_size.height()); | 1050 0, 0, preferred_size.width(), preferred_size.height()); |
1051 current_profile_photo_->AddChildView(question_mark_button_); | 1051 current_profile_photo_->AddChildView(question_mark_button_); |
1052 } | 1052 } |
1053 | 1053 |
1054 if (browser_->profile()->IsManaged()) { | 1054 if (browser_->profile()->IsSupervised()) { |
1055 views::ImageView* supervised_icon = new views::ImageView(); | 1055 views::ImageView* supervised_icon = new views::ImageView(); |
1056 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1056 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1057 supervised_icon->SetImage( | 1057 supervised_icon->SetImage( |
1058 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED)); | 1058 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED)); |
1059 gfx::Size preferred_size = supervised_icon->GetPreferredSize(); | 1059 gfx::Size preferred_size = supervised_icon->GetPreferredSize(); |
1060 gfx::Rect parent_bounds = current_profile_photo_->bounds(); | 1060 gfx::Rect parent_bounds = current_profile_photo_->bounds(); |
1061 supervised_icon->SetBounds( | 1061 supervised_icon->SetBounds( |
1062 parent_bounds.right() - preferred_size.width(), | 1062 parent_bounds.right() - preferred_size.width(), |
1063 parent_bounds.bottom() - preferred_size.height(), | 1063 parent_bounds.bottom() - preferred_size.height(), |
1064 preferred_size.width(), | 1064 preferred_size.width(), |
1065 preferred_size.height()); | 1065 preferred_size.height()); |
1066 current_profile_photo_->AddChildView(supervised_icon); | 1066 current_profile_photo_->AddChildView(supervised_icon); |
1067 } | 1067 } |
1068 | 1068 |
1069 layout->StartRow(1, 0); | 1069 layout->StartRow(1, 0); |
1070 layout->AddView(current_profile_photo_); | 1070 layout->AddView(current_profile_photo_); |
1071 | 1071 |
1072 // Profile name, centered. | 1072 // Profile name, centered. |
1073 bool editing_allowed = !is_guest && !browser_->profile()->IsManaged(); | 1073 bool editing_allowed = !is_guest && !browser_->profile()->IsSupervised(); |
1074 current_profile_name_ = new EditableProfileName( | 1074 current_profile_name_ = new EditableProfileName( |
1075 this, profiles::GetAvatarNameForProfile(browser_->profile()), | 1075 this, profiles::GetAvatarNameForProfile(browser_->profile()), |
1076 editing_allowed); | 1076 editing_allowed); |
1077 layout->StartRow(1, 0); | 1077 layout->StartRow(1, 0); |
1078 layout->AddView(current_profile_name_); | 1078 layout->AddView(current_profile_name_); |
1079 | 1079 |
1080 if (is_guest) | 1080 if (is_guest) |
1081 return view; | 1081 return view; |
1082 | 1082 |
1083 // The available links depend on the type of profile that is active. | 1083 // The available links depend on the type of profile that is active. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 | 1214 |
1215 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { | 1215 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { |
1216 views::View* view = new views::View(); | 1216 views::View* view = new views::View(); |
1217 views::GridLayout* layout = CreateSingleColumnLayout( | 1217 views::GridLayout* layout = CreateSingleColumnLayout( |
1218 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 1218 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
1219 layout->SetInsets(views::kRelatedControlVerticalSpacing, | 1219 layout->SetInsets(views::kRelatedControlVerticalSpacing, |
1220 views::kButtonHEdgeMarginNew, | 1220 views::kButtonHEdgeMarginNew, |
1221 views::kRelatedControlVerticalSpacing, | 1221 views::kRelatedControlVerticalSpacing, |
1222 views::kButtonHEdgeMarginNew); | 1222 views::kButtonHEdgeMarginNew); |
1223 views::Label* disclaimer = new views::Label( | 1223 views::Label* disclaimer = new views::Label( |
1224 avatar_menu_->GetManagedUserInformation()); | 1224 avatar_menu_->GetSupervisedUserInformation()); |
1225 disclaimer->SetMultiLine(true); | 1225 disclaimer->SetMultiLine(true); |
1226 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1226 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1227 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1227 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1228 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); | 1228 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); |
1229 layout->StartRow(1, 0); | 1229 layout->StartRow(1, 0); |
1230 layout->AddView(disclaimer); | 1230 layout->AddView(disclaimer); |
1231 | 1231 |
1232 return view; | 1232 return view; |
1233 } | 1233 } |
1234 | 1234 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 layout->StartRowWithPadding( | 1474 layout->StartRowWithPadding( |
1475 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1475 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1476 layout->AddView(end_preview_and_relaunch_button_); | 1476 layout->AddView(end_preview_and_relaunch_button_); |
1477 | 1477 |
1478 TitleCard* title_card = new TitleCard( | 1478 TitleCard* title_card = new TitleCard( |
1479 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1479 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
1480 return TitleCard::AddPaddedTitleCard( | 1480 return TitleCard::AddPaddedTitleCard( |
1481 view, title_card, kFixedAccountRemovalViewWidth); | 1481 view, title_card, kFixedAccountRemovalViewWidth); |
1482 } | 1482 } |
1483 | 1483 |
OLD | NEW |