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

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

Issue 435423005: Implement the inline signin confirmation bubble and mirror upgrade tutorial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/first_run/first_run.h"
10 #include "chrome/browser/lifetime/application_lifetime.h" 11 #include "chrome/browser/lifetime/application_lifetime.h"
11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
12 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
13 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profile_metrics.h" 15 #include "chrome/browser/profiles/profile_metrics.h"
15 #include "chrome/browser/profiles/profile_window.h" 16 #include "chrome/browser/profiles/profile_window.h"
16 #include "chrome/browser/profiles/profiles_state.h" 17 #include "chrome/browser/profiles/profiles_state.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/signin/signin_header_helper.h" 19 #include "chrome/browser/signin/signin_header_helper.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/signin/signin_promo.h" 21 #include "chrome/browser/signin/signin_promo.h"
21 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_commands.h" 23 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/browser/ui/browser_dialogs.h" 24 #include "chrome/browser/ui/browser_dialogs.h"
24 #include "chrome/browser/ui/chrome_pages.h" 25 #include "chrome/browser/ui/chrome_pages.h"
25 #include "chrome/browser/ui/singleton_tabs.h" 26 #include "chrome/browser/ui/singleton_tabs.h"
26 #include "chrome/browser/ui/views/profiles/user_manager_view.h" 27 #include "chrome/browser/ui/views/profiles/user_manager_view.h"
28 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
29 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
27 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
28 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
29 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" 32 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h"
30 #include "components/signin/core/browser/profile_oauth2_token_service.h" 33 #include "components/signin/core/browser/profile_oauth2_token_service.h"
31 #include "components/signin/core/browser/signin_error_controller.h" 34 #include "components/signin/core/browser/signin_error_controller.h"
32 #include "components/signin/core/browser/signin_manager.h" 35 #include "components/signin/core/browser/signin_manager.h"
33 #include "components/signin/core/common/profile_management_switches.h" 36 #include "components/signin/core/common/profile_management_switches.h"
34 #include "grit/chromium_strings.h" 37 #include "grit/chromium_strings.h"
35 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
36 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
(...skipping 20 matching lines...) Expand all
57 #include "ui/views/layout/grid_layout.h" 60 #include "ui/views/layout/grid_layout.h"
58 #include "ui/views/layout/layout_constants.h" 61 #include "ui/views/layout/layout_constants.h"
59 #include "ui/views/widget/widget.h" 62 #include "ui/views/widget/widget.h"
60 63
61 namespace { 64 namespace {
62 65
63 // Helpers -------------------------------------------------------------------- 66 // Helpers --------------------------------------------------------------------
64 67
65 const int kFixedMenuWidth = 250; 68 const int kFixedMenuWidth = 250;
66 const int kButtonHeight = 32; 69 const int kButtonHeight = 32;
67 const int kProfileAvatarTutorialShowMax = 1;
68 const int kFixedGaiaViewHeight = 400; 70 const int kFixedGaiaViewHeight = 400;
69 const int kFixedGaiaViewWidth = 360; 71 const int kFixedGaiaViewWidth = 360;
70 const int kFixedAccountRemovalViewWidth = 280; 72 const int kFixedAccountRemovalViewWidth = 280;
71 const int kFixedEndPreviewViewWidth = 280; 73 const int kFixedEndPreviewViewWidth = 280;
72 const int kLargeImageSide = 88; 74 const int kLargeImageSide = 88;
73 75
76 // The maximum number of times to show the welcome tutorial for an upgrade user.
77 const int kUpgradeWelcomeTutorialShowMax = 1;
78
74 // Creates a GridLayout with a single column. This ensures that all the child 79 // Creates a GridLayout with a single column. This ensures that all the child
75 // views added get auto-expanded to fill the full width of the bubble. 80 // views added get auto-expanded to fill the full width of the bubble.
76 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { 81 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) {
77 views::GridLayout* layout = new views::GridLayout(view); 82 views::GridLayout* layout = new views::GridLayout(view);
78 view->SetLayoutManager(layout); 83 view->SetLayoutManager(layout);
79 84
80 views::ColumnSet* columns = layout->AddColumnSet(0); 85 views::ColumnSet* columns = layout->AddColumnSet(0);
81 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, 86 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0,
82 views::GridLayout::FIXED, width, width); 87 views::GridLayout::FIXED, width, width);
83 return layout; 88 return layout;
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 ProfileOAuth2TokenService* oauth2_token_service = 520 ProfileOAuth2TokenService* oauth2_token_service =
516 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); 521 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile());
517 if (oauth2_token_service) 522 if (oauth2_token_service)
518 oauth2_token_service->RemoveObserver(this); 523 oauth2_token_service->RemoveObserver(this);
519 } 524 }
520 525
521 void ProfileChooserView::ResetView() { 526 void ProfileChooserView::ResetView() {
522 open_other_profile_indexes_map_.clear(); 527 open_other_profile_indexes_map_.clear();
523 delete_account_button_map_.clear(); 528 delete_account_button_map_.clear();
524 reauth_account_button_map_.clear(); 529 reauth_account_button_map_.clear();
525 tutorial_learn_more_link_ = NULL;
526 tutorial_ok_button_ = NULL;
527 tutorial_enable_new_profile_management_button_ = NULL;
528 tutorial_end_preview_link_ = NULL;
529 tutorial_send_feedback_button_ = NULL;
530 manage_accounts_link_ = NULL; 530 manage_accounts_link_ = NULL;
531 signin_current_profile_link_ = NULL; 531 signin_current_profile_link_ = NULL;
532 question_mark_button_ = NULL;
533 auth_error_email_button_ = NULL; 532 auth_error_email_button_ = NULL;
534 current_profile_photo_ = NULL; 533 current_profile_photo_ = NULL;
535 current_profile_name_ = NULL; 534 current_profile_name_ = NULL;
536 users_button_ = NULL; 535 users_button_ = NULL;
537 go_incognito_button_ = NULL; 536 go_incognito_button_ = NULL;
538 lock_button_ = NULL; 537 lock_button_ = NULL;
539 add_account_link_ = NULL; 538 add_account_link_ = NULL;
540 gaia_signin_cancel_button_ = NULL; 539 gaia_signin_cancel_button_ = NULL;
541 remove_account_button_ = NULL; 540 remove_account_button_ = NULL;
542 account_removal_cancel_button_ = NULL; 541 account_removal_cancel_button_ = NULL;
543 end_preview_and_relaunch_button_ = NULL; 542 tutorial_sync_settings_ok_button_ = NULL;
544 end_preview_cancel_button_ = NULL; 543 tutorial_sync_settings_link_ = NULL;
544 tutorial_learn_more_link_ = NULL;
545 tutorial_see_whats_new_button_ = NULL;
546 tutorial_not_you_link_ = NULL;
545 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; 547 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
546 } 548 }
547 549
548 void ProfileChooserView::Init() { 550 void ProfileChooserView::Init() {
549 // If view mode is PROFILE_CHOOSER but there is an auth error, force 551 // If view mode is PROFILE_CHOOSER but there is an auth error, force
550 // ACCOUNT_MANAGEMENT mode. 552 // ACCOUNT_MANAGEMENT mode.
551 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && 553 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER &&
552 HasAuthError(browser_->profile()) && 554 HasAuthError(browser_->profile()) &&
553 switches::IsEnableAccountConsistency() && 555 switches::IsEnableAccountConsistency() &&
554 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()). 556 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()).
555 signed_in) { 557 signed_in) {
556 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; 558 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
557 } 559 }
558 560
559 ShowView(view_mode_, avatar_menu_.get()); 561 ShowView(view_mode_, avatar_menu_.get());
560 } 562 }
561 563
562 void ProfileChooserView::OnAvatarMenuChanged( 564 void ProfileChooserView::OnAvatarMenuChanged(
563 AvatarMenu* avatar_menu) { 565 AvatarMenu* avatar_menu) {
566 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ||
567 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN ||
568 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT ||
569 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) {
570 return;
571 }
Roger Tawa OOO till Jul 10th 2014/08/05 16:02:13 Add comment explaining why we ignore these modes?
guohui 2014/08/05 19:27:41 Done.
572
564 // Refresh the view with the new menu. We can't just update the local copy 573 // Refresh the view with the new menu. We can't just update the local copy
565 // as this may have been triggered by a sign out action, in which case 574 // as this may have been triggered by a sign out action, in which case
566 // the view is being destroyed. 575 // the view is being destroyed.
567 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu); 576 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu);
568 } 577 }
569 578
570 void ProfileChooserView::OnRefreshTokenAvailable( 579 void ProfileChooserView::OnRefreshTokenAvailable(
571 const std::string& account_id) { 580 const std::string& account_id) {
572 // Refresh the account management view when a new account is added to the
573 // profile.
574 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || 581 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ||
575 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || 582 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN ||
576 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || 583 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT ||
577 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { 584 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) {
585 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN)
586 tutorial_mode_ = profiles::TUTORIAL_MODE_CONFIRM_SIGNIN;
578 // The account management UI is only available through the 587 // The account management UI is only available through the
579 // --enable-account-consistency flag. 588 // --enable-account-consistency flag.
580 ShowView(switches::IsEnableAccountConsistency() ? 589 ShowView(switches::IsEnableAccountConsistency() ?
581 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : 590 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
582 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 591 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
583 } 592 }
584 } 593 }
585 594
586 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { 595 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) {
587 // Refresh the account management view when an account is removed from the 596 // Refresh the account management view when an account is removed from the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: 629 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN:
621 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: 630 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
622 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: 631 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH:
623 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); 632 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth);
624 sub_view = CreateGaiaSigninView(); 633 sub_view = CreateGaiaSigninView();
625 break; 634 break;
626 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: 635 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL:
627 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); 636 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth);
628 sub_view = CreateAccountRemovalView(); 637 sub_view = CreateAccountRemovalView();
629 break; 638 break;
630 case profiles::BUBBLE_VIEW_MODE_END_PREVIEW:
631 layout = CreateSingleColumnLayout(this, kFixedEndPreviewViewWidth);
632 sub_view = CreateEndPreviewView();
633 break;
634 default: 639 default:
635 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); 640 layout = CreateSingleColumnLayout(this, kFixedMenuWidth);
636 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode); 641 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode);
637 } 642 }
638 layout->StartRow(1, 0); 643 layout->StartRow(1, 0);
639 layout->AddView(sub_view); 644 layout->AddView(sub_view);
640 Layout(); 645 Layout();
641 if (GetBubbleFrameView()) 646 if (GetBubbleFrameView())
642 SizeToContents(); 647 SizeToContents();
643 } 648 }
644 649
645 void ProfileChooserView::WindowClosing() { 650 void ProfileChooserView::WindowClosing() {
646 DCHECK_EQ(profile_bubble_, this); 651 DCHECK_EQ(profile_bubble_, this);
647 profile_bubble_ = NULL; 652 profile_bubble_ = NULL;
653
654 if (tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) {
655 LoginUIServiceFactory::GetForProfile(browser_->profile())->
656 SyncConfirmationUIClosed(false /* configure_sync_first */);
657 }
648 } 658 }
649 659
650 void ProfileChooserView::ButtonPressed(views::Button* sender, 660 void ProfileChooserView::ButtonPressed(views::Button* sender,
651 const ui::Event& event) { 661 const ui::Event& event) {
652 // Disable button after clicking so that it doesn't get clicked twice and 662 // Disable button after clicking so that it doesn't get clicked twice and
653 // start a second action... which can crash Chrome. But don't disable if it 663 // start a second action... which can crash Chrome. But don't disable if it
654 // has no parent (like in tests) because that will also crash. 664 // has no parent (like in tests) because that will also crash.
655 if (sender->parent()) 665 if (sender->parent())
656 sender->SetEnabled(false); 666 sender->SetEnabled(false);
657 667
658 if (sender == users_button_) { 668 if (sender == users_button_) {
659 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); 669 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile());
660 // If this is a guest session, also close all the guest browser windows. 670 // If this is a guest session, also close all the guest browser windows.
661 if (browser_->profile()->IsGuestSession()) 671 if (browser_->profile()->IsGuestSession())
662 profiles::CloseGuestProfileWindows(); 672 profiles::CloseGuestProfileWindows();
663 } else if (sender == go_incognito_button_) { 673 } else if (sender == go_incognito_button_) {
664 DCHECK(!browser_->profile()->IsGuestSession()); 674 DCHECK(!browser_->profile()->IsGuestSession());
665 chrome::NewIncognitoWindow(browser_); 675 chrome::NewIncognitoWindow(browser_);
666 } else if (sender == lock_button_) { 676 } else if (sender == lock_button_) {
667 profiles::LockProfile(browser_->profile()); 677 profiles::LockProfile(browser_->profile());
668 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); 678 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK);
669 } else if (sender == auth_error_email_button_) { 679 } else if (sender == auth_error_email_button_) {
670 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); 680 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get());
671 } else if (sender == tutorial_ok_button_) { 681 } else if (sender == tutorial_sync_settings_ok_button_) {
672 // If the user manually dismissed the tutorial, never show it again by 682 LoginUIServiceFactory::GetForProfile(browser_->profile())->
673 // setting the number of times shown to the maximum plus 1, so that later we 683 SyncConfirmationUIClosed(false /* configure_sync_first */);
674 // could distinguish between the dismiss case and the case when the tutorial 684 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
675 // is indeed shown for the maximum number of times.
676 browser_->profile()->GetPrefs()->SetInteger(
677 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1);
678
679 ProfileMetrics::LogProfileUpgradeEnrollment(
680 ProfileMetrics::PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD);
681 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 685 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
682 } else if (sender == tutorial_enable_new_profile_management_button_) { 686 } else if (sender == tutorial_see_whats_new_button_) {
683 ProfileMetrics::LogProfileUpgradeEnrollment( 687 chrome::ShowUserManagerWithTutorial(
684 ProfileMetrics::PROFILE_ENROLLMENT_ACCEPT_NEW_PROFILE_MGMT); 688 profiles::USER_MANAGER_TUTORIAL_OVERVIEW);
685 profiles::EnableNewProfileManagementPreview(browser_->profile());
686 } else if (sender == remove_account_button_) { 689 } else if (sender == remove_account_button_) {
687 RemoveAccount(); 690 RemoveAccount();
688 } else if (sender == account_removal_cancel_button_) { 691 } else if (sender == account_removal_cancel_button_) {
689 account_id_to_remove_.clear(); 692 account_id_to_remove_.clear();
690 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); 693 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get());
691 } else if (sender == gaia_signin_cancel_button_) { 694 } else if (sender == gaia_signin_cancel_button_) {
692 std::string primary_account = 695 std::string primary_account =
693 SigninManagerFactory::GetForProfile(browser_->profile())-> 696 SigninManagerFactory::GetForProfile(browser_->profile())->
694 GetAuthenticatedUsername(); 697 GetAuthenticatedUsername();
695 // The account management view is only available with the 698 // The account management view is only available with the
696 // --enable-account-consistency flag. 699 // --enable-account-consistency flag.
697 bool account_management_available = !primary_account.empty() && 700 bool account_management_available = !primary_account.empty() &&
698 switches::IsEnableAccountConsistency(); 701 switches::IsEnableAccountConsistency();
699 ShowView(account_management_available ? 702 ShowView(account_management_available ?
700 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : 703 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
701 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 704 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
702 } else if (sender == question_mark_button_) {
703 tutorial_mode_ = profiles::TUTORIAL_MODE_SEND_FEEDBACK;
704 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
705 } else if (sender == tutorial_send_feedback_button_) {
706 ProfileMetrics::LogProfileUpgradeEnrollment(
707 ProfileMetrics::PROFILE_ENROLLMENT_SEND_FEEDBACK);
708 chrome::OpenFeedbackDialog(browser_);
709 } else if (sender == end_preview_and_relaunch_button_) {
710 ProfileMetrics::LogProfileUpgradeEnrollment(
711 ProfileMetrics::PROFILE_ENROLLMENT_DISABLE_NEW_PROFILE_MGMT);
712 profiles::DisableNewProfileManagementPreview(browser_->profile());
713 } else if (sender == end_preview_cancel_button_) {
714 tutorial_mode_ = profiles::TUTORIAL_MODE_SEND_FEEDBACK;
715 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
716 } else if (current_profile_photo_ && 705 } else if (current_profile_photo_ &&
717 sender == current_profile_photo_->change_photo_button()) { 706 sender == current_profile_photo_->change_photo_button()) {
718 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); 707 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex());
719 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); 708 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE);
720 } else if (sender == signin_current_profile_link_) { 709 } else if (sender == signin_current_profile_link_) {
721 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); 710 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get());
722 } else { 711 } else {
723 // Either one of the "other profiles", or one of the profile accounts 712 // Either one of the "other profiles", or one of the profile accounts
724 // buttons was pressed. 713 // buttons was pressed.
725 ButtonIndexes::const_iterator profile_match = 714 ButtonIndexes::const_iterator profile_match =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // depending on which view it is displayed. ShowView() will DCHECK if 755 // depending on which view it is displayed. ShowView() will DCHECK if
767 // the account management view is displayed for non signed-in users. 756 // the account management view is displayed for non signed-in users.
768 ShowView( 757 ShowView(
769 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? 758 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ?
770 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : 759 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER :
771 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, 760 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT,
772 avatar_menu_.get()); 761 avatar_menu_.get());
773 } else if (sender == add_account_link_) { 762 } else if (sender == add_account_link_) {
774 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); 763 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get());
775 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT); 764 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT);
765 } else if (sender == tutorial_sync_settings_link_) {
766 LoginUIServiceFactory::GetForProfile(browser_->profile())->
767 SyncConfirmationUIClosed(true /* configure_sync_first */);
Roger Tawa OOO till Jul 10th 2014/08/05 16:02:13 Do you need to reset the tutorial mode to none her
guohui 2014/08/05 19:27:41 Done.
776 } else if (sender == tutorial_learn_more_link_) { 768 } else if (sender == tutorial_learn_more_link_) {
777 ProfileMetrics::LogProfileUpgradeEnrollment( 769 // TODO(mlerman): update the UMA stats.
778 ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE);
779 // TODO(guohui): update |learn_more_url| once it is decided. 770 // TODO(guohui): update |learn_more_url| once it is decided.
780 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); 771 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to");
781 chrome::NavigateParams params( 772 chrome::NavigateParams params(
782 browser_->profile(), 773 browser_->profile(),
783 lear_more_url, 774 lear_more_url,
784 content::PAGE_TRANSITION_LINK); 775 content::PAGE_TRANSITION_LINK);
785 params.disposition = NEW_FOREGROUND_TAB; 776 params.disposition = NEW_FOREGROUND_TAB;
786 chrome::Navigate(&params); 777 chrome::Navigate(&params);
787 } else { 778 } else {
788 DCHECK(sender == tutorial_end_preview_link_); 779 DCHECK(sender == tutorial_not_you_link_);
789 ShowView(profiles::BUBBLE_VIEW_MODE_END_PREVIEW, avatar_menu_.get()); 780 // TODO(guohui): show a "not XXX" view.
790 } 781 }
791 } 782 }
792 783
793 void ProfileChooserView::StyledLabelLinkClicked( 784 void ProfileChooserView::StyledLabelLinkClicked(
794 const gfx::Range& range, int event_flags) { 785 const gfx::Range& range, int event_flags) {
795 chrome::ShowSettings(browser_); 786 chrome::ShowSettings(browser_);
796 } 787 }
797 788
798 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, 789 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender,
799 const ui::KeyEvent& key_event) { 790 const ui::KeyEvent& key_event) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 views::View* current_profile_accounts = NULL; 837 views::View* current_profile_accounts = NULL;
847 views::View* option_buttons_view = NULL; 838 views::View* option_buttons_view = NULL;
848 bool is_enable_account_consistency = switches::IsEnableAccountConsistency(); 839 bool is_enable_account_consistency = switches::IsEnableAccountConsistency();
849 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { 840 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
850 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); 841 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
851 if (item.active) { 842 if (item.active) {
852 option_buttons_view = CreateOptionsView( 843 option_buttons_view = CreateOptionsView(
853 switches::IsNewProfileManagement() && item.signed_in); 844 switches::IsNewProfileManagement() && item.signed_in);
854 current_profile_view = CreateCurrentProfileView(item, false); 845 current_profile_view = CreateCurrentProfileView(item, false);
855 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { 846 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
856 if (is_enable_account_consistency) { 847 switch (last_tutorial_mode) {
857 tutorial_view = 848 case profiles::TUTORIAL_MODE_NONE:
858 last_tutorial_mode == profiles::TUTORIAL_MODE_SEND_FEEDBACK ? 849 case profiles::TUTORIAL_MODE_WELCOME_UPGRADE:
859 CreateSendPreviewFeedbackView() : 850 tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded(
860 CreatePreviewEnabledTutorialView( 851 last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
861 item, last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME); 852 item);
853 break;
854 case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN:
855 tutorial_view = CreateSigninConfirmationView();
856 break;
857 case profiles::TUTORIAL_MODE_SHOW_ERROR:
858 // TODO(guohui): not implemented yet.
859 NOTREACHED();
862 } 860 }
863 } else { 861 } else {
864 current_profile_accounts = CreateCurrentProfileAccountsView(item); 862 current_profile_accounts = CreateCurrentProfileAccountsView(item);
865 } 863 }
866 } else { 864 } else {
867 other_profiles.push_back(i); 865 other_profiles.push_back(i);
868 } 866 }
869 } 867 }
870 868
871 if (tutorial_view) { 869 if (tutorial_view) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 912 layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
915 913
916 if (option_buttons_view) { 914 if (option_buttons_view) {
917 layout->StartRow(0, 0); 915 layout->StartRow(0, 0);
918 layout->AddView(option_buttons_view); 916 layout->AddView(option_buttons_view);
919 } 917 }
920 918
921 return view; 919 return view;
922 } 920 }
923 921
924 views::View* ProfileChooserView::CreatePreviewEnabledTutorialView(
925 const AvatarMenu::Item& current_avatar_item,
926 bool tutorial_shown) {
927 if (!switches::IsNewProfileManagementPreviewEnabled())
928 return NULL;
929
930 Profile* profile = browser_->profile();
931 const int show_count = profile->GetPrefs()->GetInteger(
932 prefs::kProfileAvatarTutorialShown);
933 // Do not show the tutorial if user has dismissed it.
934 if (show_count > kProfileAvatarTutorialShowMax)
935 return NULL;
936
937 if (!tutorial_shown) {
938 if (show_count == kProfileAvatarTutorialShowMax)
939 return NULL;
940 profile->GetPrefs()->SetInteger(
941 prefs::kProfileAvatarTutorialShown, show_count + 1);
942 }
943
944 return CreateTutorialView(
945 profiles::TUTORIAL_MODE_WELCOME,
946 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE),
947 l10n_util::GetStringUTF16(
948 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT),
949 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE),
950 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON),
951 &tutorial_learn_more_link_,
952 &tutorial_ok_button_);
953 }
954
955 views::View* ProfileChooserView::CreateSendPreviewFeedbackView() {
956 return CreateTutorialView(
957 profiles::TUTORIAL_MODE_SEND_FEEDBACK,
958 l10n_util::GetStringUTF16(IDS_PROFILES_FEEDBACK_TUTORIAL_TITLE),
959 l10n_util::GetStringUTF16(
960 IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT),
961 l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW),
962 l10n_util::GetStringUTF16(IDS_PROFILES_SEND_FEEDBACK_BUTTON),
963 &tutorial_end_preview_link_,
964 &tutorial_send_feedback_button_);
965 }
966
967 views::View* ProfileChooserView::CreateTutorialView( 922 views::View* ProfileChooserView::CreateTutorialView(
968 profiles::TutorialMode tutorial_mode, 923 profiles::TutorialMode tutorial_mode,
969 const base::string16& title_text, 924 const base::string16& title_text,
970 const base::string16& content_text, 925 const base::string16& content_text,
971 const base::string16& link_text, 926 const base::string16& link_text,
972 const base::string16& button_text, 927 const base::string16& button_text,
973 views::Link** link, 928 views::Link** link,
974 views::LabelButton** button) { 929 views::LabelButton** button) {
975 tutorial_mode_ = tutorial_mode; 930 tutorial_mode_ = tutorial_mode;
976 931
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 button_layout->AddView(*link); 978 button_layout->AddView(*link);
1024 979
1025 *button = new views::LabelButton(this, button_text); 980 *button = new views::LabelButton(this, button_text);
1026 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); 981 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER);
1027 (*button)->SetStyle(views::Button::STYLE_BUTTON); 982 (*button)->SetStyle(views::Button::STYLE_BUTTON);
1028 button_layout->AddView(*button); 983 button_layout->AddView(*button);
1029 984
1030 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); 985 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1031 layout->AddView(button_row); 986 layout->AddView(button_row);
1032 987
1033 // Adds a padded caret image at the bottom. 988 return view;
1034 views::View* padded_caret_view = new views::View();
1035 views::GridLayout* padded_caret_layout =
1036 new views::GridLayout(padded_caret_view);
1037 views::ColumnSet* padded_columns = padded_caret_layout->AddColumnSet(0);
1038 padded_columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
1039 padded_columns->AddColumn(views::GridLayout::LEADING,
1040 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1041 padded_caret_view->SetLayoutManager(padded_caret_layout);
1042
1043 views::ImageView* caret_image_view = new views::ImageView();
1044 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1045 caret_image_view->SetImage(
1046 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_CARET));
1047
1048 padded_caret_layout->StartRow(1, 0);
1049 padded_caret_layout->AddView(caret_image_view);
1050
1051 views::View* view_with_caret = new views::View();
1052 views::GridLayout* layout_with_caret =
1053 CreateSingleColumnLayout(view_with_caret, kFixedMenuWidth);
1054 layout_with_caret->StartRow(1, 0);
1055 layout_with_caret->AddView(view);
1056 layout_with_caret->StartRow(1, 0);
1057 layout_with_caret->AddView(padded_caret_view);
1058 return view_with_caret;
1059 } 989 }
1060 990
1061 views::View* ProfileChooserView::CreateCurrentProfileView( 991 views::View* ProfileChooserView::CreateCurrentProfileView(
1062 const AvatarMenu::Item& avatar_item, 992 const AvatarMenu::Item& avatar_item,
1063 bool is_guest) { 993 bool is_guest) {
1064 views::View* view = new views::View(); 994 views::View* view = new views::View();
1065 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; 995 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew;
1066 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); 996 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width);
1067 layout->SetInsets(views::kButtonVEdgeMarginNew, 997 layout->SetInsets(views::kButtonVEdgeMarginNew,
1068 views::kButtonHEdgeMarginNew, 998 views::kButtonHEdgeMarginNew,
1069 views::kUnrelatedControlVerticalSpacing, 999 views::kUnrelatedControlVerticalSpacing,
1070 views::kButtonHEdgeMarginNew); 1000 views::kButtonHEdgeMarginNew);
1071 1001
1072 // Profile icon, centered. 1002 // Profile icon, centered.
1073 int x_offset = (column_width - kLargeImageSide) / 2; 1003 int x_offset = (column_width - kLargeImageSide) / 2;
1074 current_profile_photo_ = new EditableProfilePhoto( 1004 current_profile_photo_ = new EditableProfilePhoto(
1075 this, avatar_item.icon, !is_guest, 1005 this, avatar_item.icon, !is_guest,
1076 gfx::Rect(x_offset, 0, kLargeImageSide, kLargeImageSide)); 1006 gfx::Rect(x_offset, 0, kLargeImageSide, kLargeImageSide));
1077 SizedContainer* profile_icon_container = 1007 SizedContainer* profile_icon_container =
1078 new SizedContainer(gfx::Size(column_width, kLargeImageSide)); 1008 new SizedContainer(gfx::Size(column_width, kLargeImageSide));
1079 profile_icon_container->AddChildView(current_profile_photo_); 1009 profile_icon_container->AddChildView(current_profile_photo_);
1080 1010
1081 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1011 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1082 if (switches::IsNewProfileManagementPreviewEnabled()) {
1083 question_mark_button_ = new views::ImageButton(this);
1084 question_mark_button_->SetImageAlignment(
1085 views::ImageButton::ALIGN_LEFT, views::ImageButton::ALIGN_MIDDLE);
1086 question_mark_button_->SetImage(views::ImageButton::STATE_NORMAL,
1087 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_STABLE));
1088 question_mark_button_->SetImage(views::ImageButton::STATE_HOVERED,
1089 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_HOVER));
1090 question_mark_button_->SetImage(views::ImageButton::STATE_PRESSED,
1091 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_SELECT));
1092 gfx::Size preferred_size = question_mark_button_->GetPreferredSize();
1093 question_mark_button_->SetBounds(
1094 0, 0, preferred_size.width(), preferred_size.height());
1095 profile_icon_container->AddChildView(question_mark_button_);
1096 }
1097
1098 if (browser_->profile()->IsSupervised()) { 1012 if (browser_->profile()->IsSupervised()) {
1099 views::ImageView* supervised_icon = new views::ImageView(); 1013 views::ImageView* supervised_icon = new views::ImageView();
1100 supervised_icon->SetImage( 1014 supervised_icon->SetImage(
1101 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED)); 1015 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED));
1102 gfx::Size preferred_size = supervised_icon->GetPreferredSize(); 1016 gfx::Size preferred_size = supervised_icon->GetPreferredSize();
1103 gfx::Rect parent_bounds = current_profile_photo_->bounds(); 1017 gfx::Rect parent_bounds = current_profile_photo_->bounds();
1104 supervised_icon->SetBounds( 1018 supervised_icon->SetBounds(
1105 parent_bounds.right() - preferred_size.width(), 1019 parent_bounds.right() - preferred_size.width(),
1106 parent_bounds.bottom() - preferred_size.height(), 1020 parent_bounds.bottom() - preferred_size.height(),
1107 preferred_size.width(), 1021 preferred_size.width(),
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 views::LabelButton::STATE_NORMAL, 1066 views::LabelButton::STATE_NORMAL,
1153 views::Link::GetDefaultEnabledColor()); 1067 views::Link::GetDefaultEnabledColor());
1154 layout->AddView(auth_error_email_button_); 1068 layout->AddView(auth_error_email_button_);
1155 } else { 1069 } else {
1156 views::Label* email_label = new views::Label(avatar_item.sync_state); 1070 views::Label* email_label = new views::Label(avatar_item.sync_state);
1157 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); 1071 email_label->SetElideBehavior(gfx::ELIDE_EMAIL);
1158 layout->AddView(email_label); 1072 layout->AddView(email_label);
1159 } 1073 }
1160 } 1074 }
1161 } else { 1075 } else {
1162 SigninManagerBase* signin_manager = 1076 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(
1163 SigninManagerFactory::GetForProfile( 1077 browser_->profile()->GetOriginalProfile());
1164 browser_->profile()->GetOriginalProfile());
1165 if (signin_manager->IsSigninAllowed()) { 1078 if (signin_manager->IsSigninAllowed()) {
1166 views::Label* promo = new views::Label( 1079 views::Label* promo = new views::Label(
1167 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO)); 1080 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO));
1168 promo->SetMultiLine(true); 1081 promo->SetMultiLine(true);
1169 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1082 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1170 layout->StartRowWithPadding(1, 0, 0, 1083 layout->StartRowWithPadding(1, 0, 0,
1171 views::kRelatedControlSmallVerticalSpacing); 1084 views::kRelatedControlSmallVerticalSpacing);
1172 layout->StartRow(1, 0); 1085 layout->StartRow(1, 0);
1173 layout->AddView(promo); 1086 layout->AddView(promo);
1174 1087
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 } else { 1393 } else {
1481 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); 1394 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
1482 } 1395 }
1483 1396
1484 TitleCard* title_card = new TitleCard(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE, 1397 TitleCard* title_card = new TitleCard(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE,
1485 this, &account_removal_cancel_button_); 1398 this, &account_removal_cancel_button_);
1486 return TitleCard::AddPaddedTitleCard(view, title_card, 1399 return TitleCard::AddPaddedTitleCard(view, title_card,
1487 kFixedAccountRemovalViewWidth); 1400 kFixedAccountRemovalViewWidth);
1488 } 1401 }
1489 1402
1490 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() { 1403 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded(
1404 bool tutorial_shown, const AvatarMenu::Item& avatar_item){
1405 if (first_run::IsChromeFirstRun())
1406 return NULL;
1407
1408 Profile* profile = browser_->profile();
1409 if (!avatar_item.signed_in) {
1410 profile->GetPrefs()->SetInteger(
1411 prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1);
1412 return NULL;
1413 }
1414
1415 const int show_count = profile->GetPrefs()->GetInteger(
1416 prefs::kProfileAvatarTutorialShown);
1417 // Do not show the tutorial if user has dismissed it.
1418 if (show_count > kUpgradeWelcomeTutorialShowMax)
1419 return NULL;
1420
1421 if (!tutorial_shown) {
1422 if (show_count == kUpgradeWelcomeTutorialShowMax)
1423 return NULL;
1424 profile->GetPrefs()->SetInteger(
1425 prefs::kProfileAvatarTutorialShown, show_count + 1);
1426 }
1427
1491 return CreateTutorialView( 1428 return CreateTutorialView(
1492 profiles::TUTORIAL_MODE_ENABLE_PREVIEW, 1429 profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
1493 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE), 1430 l10n_util::GetStringFUTF16(
1494 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT), 1431 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name),
1495 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), 1432 l10n_util::GetStringUTF16(
1496 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON), 1433 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT),
1497 &tutorial_learn_more_link_, 1434 l10n_util::GetStringFUTF16(
1498 &tutorial_enable_new_profile_management_button_); 1435 IDS_PROFILES_TUTORIAL_NOT_YOU_LINK, avatar_item.name),
1436 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON),
1437 &tutorial_not_you_link_,
1438 &tutorial_see_whats_new_button_);
1499 } 1439 }
1500 1440
1501 views::View* ProfileChooserView::CreateEndPreviewView() { 1441 views::View* ProfileChooserView::CreateSigninConfirmationView(){
1502 views::View* view = new views::View(); 1442 return CreateTutorialView(
1503 views::GridLayout* layout = CreateSingleColumnLayout( 1443 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN,
1504 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); 1444 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE),
1505 layout->SetInsets(0, 1445 l10n_util::GetStringUTF16(
1506 views::kButtonHEdgeMarginNew, 1446 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT),
1507 views::kButtonVEdgeMarginNew, 1447 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK),
1508 views::kButtonHEdgeMarginNew); 1448 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON),
1509 1449 &tutorial_sync_settings_link_,
1510 // Adds main text. 1450 &tutorial_sync_settings_ok_button_);
1511 views::Label* content_label = new views::Label(
1512 l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_TEXT));
1513 content_label->SetMultiLine(true);
1514 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1515 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1516 const gfx::FontList& small_font_list =
1517 rb->GetFontList(ui::ResourceBundle::SmallFont);
1518 content_label->SetFontList(small_font_list);
1519 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1520 layout->AddView(content_label);
1521
1522 // Adds button.
1523 end_preview_and_relaunch_button_ = new views::BlueButton(
1524 this, l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_AND_RELAUNCH));
1525 end_preview_and_relaunch_button_->SetHorizontalAlignment(
1526 gfx::ALIGN_CENTER);
1527 layout->StartRowWithPadding(
1528 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1529 layout->AddView(end_preview_and_relaunch_button_);
1530
1531 TitleCard* title_card = new TitleCard(
1532 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1533 return TitleCard::AddPaddedTitleCard(
1534 view, title_card, kFixedAccountRemovalViewWidth);
1535 } 1451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698