| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "ui/views/layout/grid_layout.h" | 61 #include "ui/views/layout/grid_layout.h" |
| 62 #include "ui/views/layout/layout_constants.h" | 62 #include "ui/views/layout/layout_constants.h" |
| 63 #include "ui/views/widget/widget.h" | 63 #include "ui/views/widget/widget.h" |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 // Helpers -------------------------------------------------------------------- | 67 // Helpers -------------------------------------------------------------------- |
| 68 | 68 |
| 69 const int kFixedMenuWidth = 250; | 69 const int kFixedMenuWidth = 250; |
| 70 const int kButtonHeight = 32; | 70 const int kButtonHeight = 32; |
| 71 const int kFixedGaiaViewHeight = 400; | 71 const int kFixedGaiaViewHeight = 440; |
| 72 const int kFixedGaiaViewWidth = 360; | 72 const int kFixedGaiaViewWidth = 360; |
| 73 const int kFixedAccountRemovalViewWidth = 280; | 73 const int kFixedAccountRemovalViewWidth = 280; |
| 74 const int kFixedSwitchUserViewWidth = 280; | 74 const int kFixedSwitchUserViewWidth = 280; |
| 75 const int kLargeImageSide = 88; | 75 const int kLargeImageSide = 88; |
| 76 | 76 |
| 77 // Creates a GridLayout with a single column. This ensures that all the child | 77 // Creates a GridLayout with a single column. This ensures that all the child |
| 78 // views added get auto-expanded to fill the full width of the bubble. | 78 // views added get auto-expanded to fill the full width of the bubble. |
| 79 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { | 79 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { |
| 80 views::GridLayout* layout = new views::GridLayout(view); | 80 views::GridLayout* layout = new views::GridLayout(view); |
| 81 view->SetLayoutManager(layout); | 81 view->SetLayoutManager(layout); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 424 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 425 | 425 |
| 426 layout->StartRow(1, 1); | 426 layout->StartRow(1, 1); |
| 427 layout->AddView(view); | 427 layout->AddView(view); |
| 428 | 428 |
| 429 return titled_view; | 429 return titled_view; |
| 430 } | 430 } |
| 431 | 431 |
| 432 private: | 432 private: |
| 433 virtual void Layout() OVERRIDE{ | 433 virtual void Layout() OVERRIDE{ |
| 434 back_button_->SetBounds( | 434 int back_button_width = back_button_->GetPreferredSize().width(); |
| 435 0, 0, back_button_->GetPreferredSize().width(), height()); | 435 back_button_->SetBounds(0, 0, back_button_width, height()); |
| 436 title_label_->SetBoundsRect(GetContentsBounds()); | 436 int label_padding = back_button_width + views::kButtonHEdgeMarginNew; |
| 437 int label_width = width() - 2 * label_padding; |
| 438 DCHECK_GT(label_width, 0); |
| 439 title_label_->SetBounds(label_padding, 0, label_width, height()); |
| 437 } | 440 } |
| 438 | 441 |
| 439 virtual gfx::Size GetPreferredSize() const OVERRIDE{ | 442 virtual gfx::Size GetPreferredSize() const OVERRIDE{ |
| 440 int height = std::max(title_label_->GetPreferredSize().height(), | 443 int height = std::max(title_label_->GetPreferredSize().height(), |
| 441 back_button_->GetPreferredSize().height()); | 444 back_button_->GetPreferredSize().height()); |
| 442 return gfx::Size(width(), height); | 445 return gfx::Size(width(), height); |
| 443 } | 446 } |
| 444 | 447 |
| 445 views::ImageButton* back_button_; | 448 views::ImageButton* back_button_; |
| 446 views::Label* title_label_; | 449 views::Label* title_label_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 go_incognito_button_ = NULL; | 545 go_incognito_button_ = NULL; |
| 543 lock_button_ = NULL; | 546 lock_button_ = NULL; |
| 544 add_account_link_ = NULL; | 547 add_account_link_ = NULL; |
| 545 gaia_signin_cancel_button_ = NULL; | 548 gaia_signin_cancel_button_ = NULL; |
| 546 remove_account_button_ = NULL; | 549 remove_account_button_ = NULL; |
| 547 account_removal_cancel_button_ = NULL; | 550 account_removal_cancel_button_ = NULL; |
| 548 add_person_button_ = NULL; | 551 add_person_button_ = NULL; |
| 549 disconnect_button_ = NULL; | 552 disconnect_button_ = NULL; |
| 550 switch_user_cancel_button_ = NULL; | 553 switch_user_cancel_button_ = NULL; |
| 551 tutorial_sync_settings_ok_button_ = NULL; | 554 tutorial_sync_settings_ok_button_ = NULL; |
| 555 tutorial_close_button_ = NULL; |
| 552 tutorial_sync_settings_link_ = NULL; | 556 tutorial_sync_settings_link_ = NULL; |
| 553 tutorial_see_whats_new_button_ = NULL; | 557 tutorial_see_whats_new_button_ = NULL; |
| 554 tutorial_not_you_link_ = NULL; | 558 tutorial_not_you_link_ = NULL; |
| 555 } | 559 } |
| 556 | 560 |
| 557 void ProfileChooserView::Init() { | 561 void ProfileChooserView::Init() { |
| 558 // If view mode is PROFILE_CHOOSER but there is an auth error, force | 562 // If view mode is PROFILE_CHOOSER but there is an auth error, force |
| 559 // ACCOUNT_MANAGEMENT mode. | 563 // ACCOUNT_MANAGEMENT mode. |
| 560 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && | 564 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && |
| 561 HasAuthError(browser_->profile()) && | 565 HasAuthError(browser_->profile()) && |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: | 645 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: |
| 642 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); | 646 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); |
| 643 sub_view = CreateSwitchUserView(); | 647 sub_view = CreateSwitchUserView(); |
| 644 ProfileMetrics::LogProfileNewAvatarMenuNotYou( | 648 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 645 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); | 649 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); |
| 646 break; | 650 break; |
| 647 default: | 651 default: |
| 648 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); | 652 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); |
| 649 sub_view = CreateProfileChooserView(avatar_menu); | 653 sub_view = CreateProfileChooserView(avatar_menu); |
| 650 } | 654 } |
| 655 // Clears tutorial mode for all non-profile-chooser views. |
| 656 if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) |
| 657 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
| 658 |
| 651 layout->StartRow(1, 0); | 659 layout->StartRow(1, 0); |
| 652 layout->AddView(sub_view); | 660 layout->AddView(sub_view); |
| 653 Layout(); | 661 Layout(); |
| 654 if (GetBubbleFrameView()) | 662 if (GetBubbleFrameView()) |
| 655 SizeToContents(); | 663 SizeToContents(); |
| 656 } | 664 } |
| 657 | 665 |
| 658 void ProfileChooserView::WindowClosing() { | 666 void ProfileChooserView::WindowClosing() { |
| 659 DCHECK_EQ(profile_bubble_, this); | 667 DCHECK_EQ(profile_bubble_, this); |
| 660 profile_bubble_ = NULL; | 668 profile_bubble_ = NULL; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 686 DCHECK(ShouldShowGoIncognito()); | 694 DCHECK(ShouldShowGoIncognito()); |
| 687 chrome::NewIncognitoWindow(browser_); | 695 chrome::NewIncognitoWindow(browser_); |
| 688 } else if (sender == lock_button_) { | 696 } else if (sender == lock_button_) { |
| 689 profiles::LockProfile(browser_->profile()); | 697 profiles::LockProfile(browser_->profile()); |
| 690 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 698 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
| 691 } else if (sender == auth_error_email_button_) { | 699 } else if (sender == auth_error_email_button_) { |
| 692 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); | 700 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); |
| 693 } else if (sender == tutorial_sync_settings_ok_button_) { | 701 } else if (sender == tutorial_sync_settings_ok_button_) { |
| 694 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 702 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 695 SyncConfirmationUIClosed(false /* configure_sync_first */); | 703 SyncConfirmationUIClosed(false /* configure_sync_first */); |
| 696 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; | 704 DismissTutorial(); |
| 697 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | |
| 698 ProfileMetrics::LogProfileNewAvatarMenuSignin( | 705 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 699 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_OK); | 706 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_OK); |
| 707 } else if (sender == tutorial_close_button_) { |
| 708 DCHECK(tutorial_mode_ != profiles::TUTORIAL_MODE_NONE && |
| 709 tutorial_mode_ != profiles::TUTORIAL_MODE_CONFIRM_SIGNIN); |
| 710 DismissTutorial(); |
| 700 } else if (sender == tutorial_see_whats_new_button_) { | 711 } else if (sender == tutorial_see_whats_new_button_) { |
| 701 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( | 712 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 702 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW); | 713 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW); |
| 703 chrome::ShowUserManagerWithTutorial( | 714 chrome::ShowUserManagerWithTutorial( |
| 704 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 715 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 705 } else if (sender == remove_account_button_) { | 716 } else if (sender == remove_account_button_) { |
| 706 RemoveAccount(); | 717 RemoveAccount(); |
| 707 } else if (sender == account_removal_cancel_button_) { | 718 } else if (sender == account_removal_cancel_button_) { |
| 708 account_id_to_remove_.clear(); | 719 account_id_to_remove_.clear(); |
| 709 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 720 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 profiles::UpdateProfileName(profile, new_profile_name); | 845 profiles::UpdateProfileName(profile, new_profile_name); |
| 835 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME); | 846 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME); |
| 836 current_profile_name_->ShowReadOnlyView(); | 847 current_profile_name_->ShowReadOnlyView(); |
| 837 return true; | 848 return true; |
| 838 } | 849 } |
| 839 return false; | 850 return false; |
| 840 } | 851 } |
| 841 | 852 |
| 842 views::View* ProfileChooserView::CreateProfileChooserView( | 853 views::View* ProfileChooserView::CreateProfileChooserView( |
| 843 AvatarMenu* avatar_menu) { | 854 AvatarMenu* avatar_menu) { |
| 844 // TODO(guohui, noms): the view should be customized based on whether new | |
| 845 // profile management preview is enabled or not. | |
| 846 | |
| 847 views::View* view = new views::View(); | 855 views::View* view = new views::View(); |
| 848 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); | 856 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); |
| 849 // Separate items into active and alternatives. | 857 // Separate items into active and alternatives. |
| 850 Indexes other_profiles; | 858 Indexes other_profiles; |
| 851 views::View* tutorial_view = NULL; | 859 views::View* tutorial_view = NULL; |
| 852 views::View* current_profile_view = NULL; | 860 views::View* current_profile_view = NULL; |
| 853 views::View* current_profile_accounts = NULL; | 861 views::View* current_profile_accounts = NULL; |
| 854 views::View* option_buttons_view = NULL; | 862 views::View* option_buttons_view = NULL; |
| 855 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { | 863 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { |
| 856 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); | 864 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 931 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 924 | 932 |
| 925 if (option_buttons_view) { | 933 if (option_buttons_view) { |
| 926 layout->StartRow(0, 0); | 934 layout->StartRow(0, 0); |
| 927 layout->AddView(option_buttons_view); | 935 layout->AddView(option_buttons_view); |
| 928 } | 936 } |
| 929 | 937 |
| 930 return view; | 938 return view; |
| 931 } | 939 } |
| 932 | 940 |
| 941 void ProfileChooserView::DismissTutorial() { |
| 942 // Never shows the upgrade tutorial again if manually closed. |
| 943 if (tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
| 944 browser_->profile()->GetPrefs()->SetInteger( |
| 945 prefs::kProfileAvatarTutorialShown, |
| 946 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); |
| 947 } |
| 948 |
| 949 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
| 950 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| 951 } |
| 952 |
| 933 views::View* ProfileChooserView::CreateTutorialView( | 953 views::View* ProfileChooserView::CreateTutorialView( |
| 934 profiles::TutorialMode tutorial_mode, | 954 profiles::TutorialMode tutorial_mode, |
| 935 const base::string16& title_text, | 955 const base::string16& title_text, |
| 936 const base::string16& content_text, | 956 const base::string16& content_text, |
| 937 const base::string16& link_text, | 957 const base::string16& link_text, |
| 938 const base::string16& button_text, | 958 const base::string16& button_text, |
| 959 bool stack_button, |
| 939 views::Link** link, | 960 views::Link** link, |
| 940 views::LabelButton** button) { | 961 views::LabelButton** button, |
| 962 views::ImageButton** close_button) { |
| 941 tutorial_mode_ = tutorial_mode; | 963 tutorial_mode_ = tutorial_mode; |
| 942 | 964 |
| 943 views::View* view = new views::View(); | 965 views::View* view = new views::View(); |
| 944 view->set_background(views::Background::CreateSolidBackground( | 966 view->set_background(views::Background::CreateSolidBackground( |
| 945 profiles::kAvatarTutorialBackgroundColor)); | 967 profiles::kAvatarTutorialBackgroundColor)); |
| 946 views::GridLayout* layout = CreateSingleColumnLayout(view, | 968 views::GridLayout* layout = CreateSingleColumnLayout(view, |
| 947 kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); | 969 kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); |
| 970 // Creates a second column set for buttons and links. |
| 971 views::ColumnSet* button_columns = layout->AddColumnSet(1); |
| 972 button_columns->AddColumn(views::GridLayout::LEADING, |
| 973 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
| 974 button_columns->AddPaddingColumn( |
| 975 1, views::kUnrelatedControlHorizontalSpacing); |
| 976 button_columns->AddColumn(views::GridLayout::TRAILING, |
| 977 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
| 948 layout->SetInsets(views::kButtonVEdgeMarginNew, | 978 layout->SetInsets(views::kButtonVEdgeMarginNew, |
| 949 views::kButtonHEdgeMarginNew, | 979 views::kButtonHEdgeMarginNew, |
| 950 views::kButtonVEdgeMarginNew, | 980 views::kButtonVEdgeMarginNew, |
| 951 views::kButtonHEdgeMarginNew); | 981 views::kButtonHEdgeMarginNew); |
| 952 | 982 |
| 953 // Adds title. | 983 // Adds title and close button if needed. |
| 954 views::Label* title_label = new views::Label(title_text); | 984 views::Label* title_label = new views::Label(title_text); |
| 955 title_label->SetMultiLine(true); | 985 title_label->SetMultiLine(true); |
| 956 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 986 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 957 title_label->SetAutoColorReadabilityEnabled(false); | 987 title_label->SetAutoColorReadabilityEnabled(false); |
| 958 title_label->SetEnabledColor(SK_ColorWHITE); | 988 title_label->SetEnabledColor(SK_ColorWHITE); |
| 959 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 989 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 960 ui::ResourceBundle::MediumFont)); | 990 ui::ResourceBundle::MediumFont)); |
| 961 layout->StartRow(1, 0); | 991 |
| 962 layout->AddView(title_label); | 992 if (close_button) { |
| 993 layout->StartRow(1, 1); |
| 994 layout->AddView(title_label); |
| 995 *close_button = new views::ImageButton(this); |
| 996 (*close_button)->SetImageAlignment(views::ImageButton::ALIGN_RIGHT, |
| 997 views::ImageButton::ALIGN_MIDDLE); |
| 998 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 999 (*close_button)->SetImage(views::ImageButton::STATE_NORMAL, |
| 1000 rb->GetImageSkiaNamed(IDR_CLOSE_1)); |
| 1001 (*close_button)->SetImage(views::ImageButton::STATE_HOVERED, |
| 1002 rb->GetImageSkiaNamed(IDR_CLOSE_1_H)); |
| 1003 (*close_button)->SetImage(views::ImageButton::STATE_PRESSED, |
| 1004 rb->GetImageSkiaNamed(IDR_CLOSE_1_P)); |
| 1005 layout->AddView(*close_button); |
| 1006 } else { |
| 1007 layout->StartRow(1, 0); |
| 1008 layout->AddView(title_label); |
| 1009 } |
| 963 | 1010 |
| 964 // Adds body content. | 1011 // Adds body content. |
| 965 views::Label* content_label = new views::Label(content_text); | 1012 views::Label* content_label = new views::Label(content_text); |
| 966 content_label->SetMultiLine(true); | 1013 content_label->SetMultiLine(true); |
| 967 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1014 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 968 content_label->SetAutoColorReadabilityEnabled(false); | 1015 content_label->SetAutoColorReadabilityEnabled(false); |
| 969 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); | 1016 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); |
| 970 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 1017 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); |
| 971 layout->AddView(content_label); | 1018 layout->AddView(content_label); |
| 972 | 1019 |
| 973 // Adds links and buttons. | 1020 // Adds links and buttons. |
| 974 views::ColumnSet* button_columns = layout->AddColumnSet(1); | 1021 *button = new views::LabelButton(this, button_text); |
| 975 button_columns->AddColumn(views::GridLayout::LEADING, | 1022 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 976 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 1023 (*button)->SetStyle(views::Button::STYLE_BUTTON); |
| 977 button_columns->AddPaddingColumn( | |
| 978 1, views::kUnrelatedControlHorizontalSpacing); | |
| 979 button_columns->AddColumn(views::GridLayout::TRAILING, | |
| 980 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | |
| 981 | 1024 |
| 982 layout->StartRowWithPadding(1, 1, 0, views::kUnrelatedControlVerticalSpacing); | 1025 bool has_link = !link_text.empty(); |
| 983 if (!link_text.empty()) { | 1026 if (has_link) { |
| 984 *link = CreateLink(link_text, this); | 1027 *link = CreateLink(link_text, this); |
| 985 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1028 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 986 (*link)->SetAutoColorReadabilityEnabled(false); | 1029 (*link)->SetAutoColorReadabilityEnabled(false); |
| 987 (*link)->SetEnabledColor(SK_ColorWHITE); | 1030 (*link)->SetEnabledColor(SK_ColorWHITE); |
| 988 layout->AddView(*link); | |
| 989 } else { | |
| 990 layout->SkipColumns(1); | |
| 991 } | 1031 } |
| 992 | 1032 |
| 993 *button = new views::LabelButton(this, button_text); | 1033 if (stack_button) { |
| 994 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 1034 layout->StartRowWithPadding( |
| 995 (*button)->SetStyle(views::Button::STYLE_BUTTON); | 1035 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
| 996 layout->AddView(*button); | 1036 layout->AddView(*button); |
| 1037 if (has_link) { |
| 1038 layout->StartRowWithPadding( |
| 1039 1, 0, 0, views::kRelatedControlVerticalSpacing); |
| 1040 (*link)->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 1041 layout->AddView(*link); |
| 1042 } |
| 1043 } else { |
| 1044 layout->StartRowWithPadding( |
| 1045 1, 1, 0, views::kUnrelatedControlVerticalSpacing); |
| 1046 if (has_link) |
| 1047 layout->AddView(*link); |
| 1048 else |
| 1049 layout->SkipColumns(1); |
| 1050 layout->AddView(*button); |
| 1051 } |
| 997 | 1052 |
| 998 return view; | 1053 return view; |
| 999 } | 1054 } |
| 1000 | 1055 |
| 1001 views::View* ProfileChooserView::CreateCurrentProfileView( | 1056 views::View* ProfileChooserView::CreateCurrentProfileView( |
| 1002 const AvatarMenu::Item& avatar_item, | 1057 const AvatarMenu::Item& avatar_item, |
| 1003 bool is_guest) { | 1058 bool is_guest) { |
| 1004 views::View* view = new views::View(); | 1059 views::View* view = new views::View(); |
| 1005 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; | 1060 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; |
| 1006 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); | 1061 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 base::string16(); | 1494 base::string16(); |
| 1440 | 1495 |
| 1441 return CreateTutorialView( | 1496 return CreateTutorialView( |
| 1442 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, | 1497 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, |
| 1443 l10n_util::GetStringUTF16( | 1498 l10n_util::GetStringUTF16( |
| 1444 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE), | 1499 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE), |
| 1445 l10n_util::GetStringUTF16( | 1500 l10n_util::GetStringUTF16( |
| 1446 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), | 1501 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), |
| 1447 link_message, | 1502 link_message, |
| 1448 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), | 1503 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), |
| 1504 true /* stack_button */, |
| 1449 &tutorial_not_you_link_, | 1505 &tutorial_not_you_link_, |
| 1450 &tutorial_see_whats_new_button_); | 1506 &tutorial_see_whats_new_button_, |
| 1507 &tutorial_close_button_); |
| 1451 } | 1508 } |
| 1452 | 1509 |
| 1453 views::View* ProfileChooserView::CreateSigninConfirmationView(){ | 1510 views::View* ProfileChooserView::CreateSigninConfirmationView(){ |
| 1454 ProfileMetrics::LogProfileNewAvatarMenuSignin( | 1511 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 1455 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_VIEW); | 1512 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_VIEW); |
| 1456 | 1513 |
| 1457 return CreateTutorialView( | 1514 return CreateTutorialView( |
| 1458 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, | 1515 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, |
| 1459 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), | 1516 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), |
| 1460 l10n_util::GetStringUTF16( | 1517 l10n_util::GetStringUTF16( |
| 1461 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT), | 1518 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT), |
| 1462 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK), | 1519 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK), |
| 1463 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), | 1520 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), |
| 1521 false /* stack_button */, |
| 1464 &tutorial_sync_settings_link_, | 1522 &tutorial_sync_settings_link_, |
| 1465 &tutorial_sync_settings_ok_button_); | 1523 &tutorial_sync_settings_ok_button_, |
| 1524 NULL /* close_button*/); |
| 1466 } | 1525 } |
| 1467 | 1526 |
| 1468 views::View* ProfileChooserView::CreateSwitchUserView() { | 1527 views::View* ProfileChooserView::CreateSwitchUserView() { |
| 1469 views::View* view = new views::View(); | 1528 views::View* view = new views::View(); |
| 1470 views::GridLayout* layout = CreateSingleColumnLayout( | 1529 views::GridLayout* layout = CreateSingleColumnLayout( |
| 1471 view, kFixedSwitchUserViewWidth); | 1530 view, kFixedSwitchUserViewWidth); |
| 1472 views::ColumnSet* columns = layout->AddColumnSet(1); | 1531 views::ColumnSet* columns = layout->AddColumnSet(1); |
| 1473 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); | 1532 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| 1474 int label_width = | 1533 int label_width = |
| 1475 kFixedSwitchUserViewWidth - 2 * views::kButtonHEdgeMarginNew; | 1534 kFixedSwitchUserViewWidth - 2 * views::kButtonHEdgeMarginNew; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1585 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1527 IncognitoModePrefs::DISABLED; | 1586 IncognitoModePrefs::DISABLED; |
| 1528 return incognito_available && !browser_->profile()->IsGuestSession(); | 1587 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1529 } | 1588 } |
| 1530 | 1589 |
| 1531 void ProfileChooserView::PostActionPerformed( | 1590 void ProfileChooserView::PostActionPerformed( |
| 1532 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1591 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1533 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1592 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1534 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1593 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1535 } | 1594 } |
| OLD | NEW |