Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 372033002: Change semantics of newProfileManagement() to accountConsistency() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix profile_chooser_controller_test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 // profile management preview is enabled or not. 815 // profile management preview is enabled or not.
816 816
817 views::View* view = new views::View(); 817 views::View* view = new views::View();
818 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 818 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
819 // Separate items into active and alternatives. 819 // Separate items into active and alternatives.
820 Indexes other_profiles; 820 Indexes other_profiles;
821 views::View* tutorial_view = NULL; 821 views::View* tutorial_view = NULL;
822 views::View* current_profile_view = NULL; 822 views::View* current_profile_view = NULL;
823 views::View* current_profile_accounts = NULL; 823 views::View* current_profile_accounts = NULL;
824 views::View* option_buttons_view = NULL; 824 views::View* option_buttons_view = NULL;
825 bool is_new_profile_management = switches::IsNewProfileManagement(); 825 bool is_enable_account_consistency = switches::IsEnableAccountConsistency();
826 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { 826 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
827 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); 827 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
828 if (item.active) { 828 if (item.active) {
829 option_buttons_view = CreateOptionsView(item.signed_in); 829 option_buttons_view = CreateOptionsView(item.signed_in);
830 current_profile_view = CreateCurrentProfileView(item, false); 830 current_profile_view = CreateCurrentProfileView(item, false);
831 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { 831 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
832 if (is_new_profile_management) { 832 if (is_enable_account_consistency) {
833 tutorial_view = 833 tutorial_view =
834 last_tutorial_mode == profiles::TUTORIAL_MODE_SEND_FEEDBACK ? 834 last_tutorial_mode == profiles::TUTORIAL_MODE_SEND_FEEDBACK ?
835 CreateSendPreviewFeedbackView() : 835 CreateSendPreviewFeedbackView() :
836 CreatePreviewEnabledTutorialView( 836 CreatePreviewEnabledTutorialView(
837 item, last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME); 837 item, last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME);
838 } else {
839 tutorial_view = CreateNewProfileManagementPreviewView();
840 } 838 }
841 } else { 839 } else {
842 current_profile_accounts = CreateCurrentProfileAccountsView(item); 840 current_profile_accounts = CreateCurrentProfileAccountsView(item);
843 } 841 }
844 } else { 842 } else {
845 other_profiles.push_back(i); 843 other_profiles.push_back(i);
846 } 844 }
847 } 845 }
848 846
849 if (tutorial_view) { 847 if (tutorial_view) {
850 // Be sure not to track the tutorial display on View refresh, and only count 848 // Be sure not to track the tutorial display on View refresh, and only count
851 // the preview-promo view, shown when New Profile Management is off. 849 // the preview-promo view, shown when New Profile Management is off.
852 if (tutorial_mode_ != last_tutorial_mode && !is_new_profile_management) { 850 if (tutorial_mode_ != last_tutorial_mode &&
851 !is_enable_account_consistency) {
853 ProfileMetrics::LogProfileUpgradeEnrollment( 852 ProfileMetrics::LogProfileUpgradeEnrollment(
854 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO); 853 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO);
855 } 854 }
856 layout->StartRow(1, 0); 855 layout->StartRow(1, 0);
857 layout->AddView(tutorial_view); 856 layout->AddView(tutorial_view);
858 } 857 }
859 858
860 if (!current_profile_view) { 859 if (!current_profile_view) {
861 // Guest windows don't have an active profile. 860 // Guest windows don't have an active profile.
862 current_profile_view = CreateGuestProfileView(); 861 current_profile_view = CreateGuestProfileView();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 editing_allowed); 1098 editing_allowed);
1100 layout->StartRow(1, 0); 1099 layout->StartRow(1, 0);
1101 layout->AddView(current_profile_name_); 1100 layout->AddView(current_profile_name_);
1102 1101
1103 if (is_guest) 1102 if (is_guest)
1104 return view; 1103 return view;
1105 1104
1106 // The available links depend on the type of profile that is active. 1105 // The available links depend on the type of profile that is active.
1107 if (avatar_item.signed_in) { 1106 if (avatar_item.signed_in) {
1108 layout->StartRow(1, 0); 1107 layout->StartRow(1, 0);
1109 if (switches::IsNewProfileManagement()) { 1108 if (switches::IsEnableAccountConsistency()) {
1110 base::string16 link_title = l10n_util::GetStringUTF16( 1109 base::string16 link_title = l10n_util::GetStringUTF16(
1111 view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? 1110 view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ?
1112 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : 1111 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON :
1113 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); 1112 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON);
1114 manage_accounts_link_ = CreateLink(link_title, this); 1113 manage_accounts_link_ = CreateLink(link_title, this);
1115 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER); 1114 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
1116 layout->AddView(manage_accounts_link_); 1115 layout->AddView(manage_accounts_link_);
1117 } else { 1116 } else {
1118 views::Label* email_label = new views::Label(avatar_item.sync_state); 1117 views::Label* email_label = new views::Label(avatar_item.sync_state);
1119 email_label->SetHorizontalAlignment(gfx::ALIGN_CENTER); 1118 email_label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 layout->StartRowWithPadding( 1492 layout->StartRowWithPadding(
1494 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1493 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1495 layout->AddView(end_preview_and_relaunch_button_); 1494 layout->AddView(end_preview_and_relaunch_button_);
1496 1495
1497 TitleCard* title_card = new TitleCard( 1496 TitleCard* title_card = new TitleCard(
1498 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); 1497 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1499 return TitleCard::AddPaddedTitleCard( 1498 return TitleCard::AddPaddedTitleCard(
1500 view, title_card, kFixedAccountRemovalViewWidth); 1499 view, title_card, kFixedAccountRemovalViewWidth);
1501 } 1500 }
1502 1501
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698