| 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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 // Profile name, centered. | 974 // Profile name, centered. |
| 975 current_profile_name_ = new EditableProfileName( | 975 current_profile_name_ = new EditableProfileName( |
| 976 this, profiles::GetAvatarNameForProfile(browser_->profile()), !is_guest); | 976 this, profiles::GetAvatarNameForProfile(browser_->profile()), !is_guest); |
| 977 layout->StartRow(1, 0); | 977 layout->StartRow(1, 0); |
| 978 layout->AddView(current_profile_name_); | 978 layout->AddView(current_profile_name_); |
| 979 | 979 |
| 980 if (is_guest) | 980 if (is_guest) |
| 981 return view; | 981 return view; |
| 982 | 982 |
| 983 // The available links depend on the type of profile that is active. | 983 // The available links depend on the type of profile that is active. |
| 984 layout->StartRow(1, 0); | |
| 985 if (avatar_item.signed_in) { | 984 if (avatar_item.signed_in) { |
| 985 layout->StartRow(1, 0); |
| 986 if (switches::IsNewProfileManagement()) { | 986 if (switches::IsNewProfileManagement()) { |
| 987 base::string16 link_title = l10n_util::GetStringUTF16( | 987 base::string16 link_title = l10n_util::GetStringUTF16( |
| 988 view_mode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? | 988 view_mode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? |
| 989 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : | 989 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : |
| 990 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); | 990 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); |
| 991 manage_accounts_link_ = CreateLink(link_title, this); | 991 manage_accounts_link_ = CreateLink(link_title, this); |
| 992 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 992 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 993 layout->AddView(manage_accounts_link_); | 993 layout->AddView(manage_accounts_link_); |
| 994 } else { | 994 } else { |
| 995 views::Label* email_label = new views::Label(avatar_item.sync_state); | 995 views::Label* email_label = new views::Label(avatar_item.sync_state); |
| 996 email_label->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 996 email_label->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 997 layout->AddView(email_label); | 997 layout->AddView(email_label); |
| 998 } | 998 } |
| 999 } else { | 999 } else { |
| 1000 signin_current_profile_link_ = new views::BlueButton( | 1000 SigninManagerBase* signin_manager = |
| 1001 this, l10n_util::GetStringFUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL, | 1001 SigninManagerFactory::GetForProfile( |
| 1002 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 1002 browser_->profile()->GetOriginalProfile()); |
| 1003 layout->AddView(signin_current_profile_link_); | 1003 if (signin_manager->IsSigninAllowed()) { |
| 1004 signin_current_profile_link_ = new views::BlueButton( |
| 1005 this, l10n_util::GetStringFUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL, |
| 1006 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
| 1007 layout->StartRow(1, 0); |
| 1008 layout->AddView(signin_current_profile_link_); |
| 1009 } |
| 1004 } | 1010 } |
| 1005 | 1011 |
| 1006 return view; | 1012 return view; |
| 1007 } | 1013 } |
| 1008 | 1014 |
| 1009 views::View* ProfileChooserView::CreateGuestProfileView() { | 1015 views::View* ProfileChooserView::CreateGuestProfileView() { |
| 1010 gfx::Image guest_icon = | 1016 gfx::Image guest_icon = |
| 1011 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 1017 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 1012 profiles::GetPlaceholderAvatarIconResourceID()); | 1018 profiles::GetPlaceholderAvatarIconResourceID()); |
| 1013 AvatarMenu::Item guest_avatar_item(0, 0, guest_icon); | 1019 AvatarMenu::Item guest_avatar_item(0, 0, guest_icon); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 layout->StartRowWithPadding( | 1310 layout->StartRowWithPadding( |
| 1305 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1311 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
| 1306 layout->AddView(end_preview_and_relaunch_button_); | 1312 layout->AddView(end_preview_and_relaunch_button_); |
| 1307 | 1313 |
| 1308 TitleCard* title_card = new TitleCard( | 1314 TitleCard* title_card = new TitleCard( |
| 1309 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1315 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); |
| 1310 return TitleCard::AddPaddedTitleCard( | 1316 return TitleCard::AddPaddedTitleCard( |
| 1311 view, title_card, kFixedAccountRemovalViewWidth); | 1317 view, title_card, kFixedAccountRemovalViewWidth); |
| 1312 } | 1318 } |
| 1313 | 1319 |
| OLD | NEW |