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/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/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
13 #include "chrome/browser/profiles/profile_info_cache.h" | 14 #include "chrome/browser/profiles/profile_info_cache.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/profiles/profile_metrics.h" | 16 #include "chrome/browser/profiles/profile_metrics.h" |
16 #include "chrome/browser/profiles/profile_window.h" | 17 #include "chrome/browser/profiles/profile_window.h" |
17 #include "chrome/browser/profiles/profiles_state.h" | 18 #include "chrome/browser/profiles/profiles_state.h" |
18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
19 #include "chrome/browser/signin/signin_header_helper.h" | 20 #include "chrome/browser/signin/signin_header_helper.h" |
20 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
21 #include "chrome/browser/signin/signin_promo.h" | 22 #include "chrome/browser/signin/signin_promo.h" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_commands.h" | 24 #include "chrome/browser/ui/browser_commands.h" |
24 #include "chrome/browser/ui/browser_dialogs.h" | 25 #include "chrome/browser/ui/browser_dialogs.h" |
25 #include "chrome/browser/ui/chrome_pages.h" | 26 #include "chrome/browser/ui/chrome_pages.h" |
26 #include "chrome/browser/ui/singleton_tabs.h" | 27 #include "chrome/browser/ui/singleton_tabs.h" |
27 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 28 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
| 29 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 30 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
28 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
30 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | 33 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 34 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
32 #include "components/signin/core/browser/signin_error_controller.h" | 35 #include "components/signin/core/browser/signin_error_controller.h" |
33 #include "components/signin/core/browser/signin_manager.h" | 36 #include "components/signin/core/browser/signin_manager.h" |
34 #include "components/signin/core/common/profile_management_switches.h" | 37 #include "components/signin/core/common/profile_management_switches.h" |
35 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
36 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
37 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
(...skipping 20 matching lines...) Expand all Loading... |
58 #include "ui/views/layout/grid_layout.h" | 61 #include "ui/views/layout/grid_layout.h" |
59 #include "ui/views/layout/layout_constants.h" | 62 #include "ui/views/layout/layout_constants.h" |
60 #include "ui/views/widget/widget.h" | 63 #include "ui/views/widget/widget.h" |
61 | 64 |
62 namespace { | 65 namespace { |
63 | 66 |
64 // Helpers -------------------------------------------------------------------- | 67 // Helpers -------------------------------------------------------------------- |
65 | 68 |
66 const int kFixedMenuWidth = 250; | 69 const int kFixedMenuWidth = 250; |
67 const int kButtonHeight = 32; | 70 const int kButtonHeight = 32; |
68 const int kProfileAvatarTutorialShowMax = 1; | |
69 const int kFixedGaiaViewHeight = 400; | 71 const int kFixedGaiaViewHeight = 400; |
70 const int kFixedGaiaViewWidth = 360; | 72 const int kFixedGaiaViewWidth = 360; |
71 const int kFixedAccountRemovalViewWidth = 280; | 73 const int kFixedAccountRemovalViewWidth = 280; |
72 const int kFixedEndPreviewViewWidth = 280; | 74 const int kFixedSwitchUserViewWidth = 280; |
73 const int kLargeImageSide = 88; | 75 const int kLargeImageSide = 88; |
74 | 76 |
| 77 // The maximum number of times to show the welcome tutorial for an upgrade user. |
| 78 const int kUpgradeWelcomeTutorialShowMax = 1; |
| 79 |
75 // Creates a GridLayout with a single column. This ensures that all the child | 80 // Creates a GridLayout with a single column. This ensures that all the child |
76 // views added get auto-expanded to fill the full width of the bubble. | 81 // views added get auto-expanded to fill the full width of the bubble. |
77 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { | 82 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { |
78 views::GridLayout* layout = new views::GridLayout(view); | 83 views::GridLayout* layout = new views::GridLayout(view); |
79 view->SetLayoutManager(layout); | 84 view->SetLayoutManager(layout); |
80 | 85 |
81 views::ColumnSet* columns = layout->AddColumnSet(0); | 86 views::ColumnSet* columns = layout->AddColumnSet(0); |
82 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, | 87 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
83 views::GridLayout::FIXED, width, width); | 88 views::GridLayout::FIXED, width, width); |
84 return layout; | 89 return layout; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Textfield that is shown when editing the profile name. Can be NULL if | 367 // Textfield that is shown when editing the profile name. Can be NULL if |
363 // the profile name isn't allowed to be edited (e.g. for guest profiles). | 368 // the profile name isn't allowed to be edited (e.g. for guest profiles). |
364 views::Textfield* profile_name_textfield_; | 369 views::Textfield* profile_name_textfield_; |
365 | 370 |
366 DISALLOW_COPY_AND_ASSIGN(EditableProfileName); | 371 DISALLOW_COPY_AND_ASSIGN(EditableProfileName); |
367 }; | 372 }; |
368 | 373 |
369 // A title card with one back button right aligned and one label center aligned. | 374 // A title card with one back button right aligned and one label center aligned. |
370 class TitleCard : public views::View { | 375 class TitleCard : public views::View { |
371 public: | 376 public: |
372 TitleCard(int message_id, views::ButtonListener* listener, | 377 TitleCard(const base::string16& message, views::ButtonListener* listener, |
373 views::ImageButton** back_button) { | 378 views::ImageButton** back_button) { |
374 back_button_ = new views::ImageButton(listener); | 379 back_button_ = new views::ImageButton(listener); |
375 back_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, | 380 back_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, |
376 views::ImageButton::ALIGN_MIDDLE); | 381 views::ImageButton::ALIGN_MIDDLE); |
377 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 382 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
378 back_button_->SetImage(views::ImageButton::STATE_NORMAL, | 383 back_button_->SetImage(views::ImageButton::STATE_NORMAL, |
379 rb->GetImageSkiaNamed(IDR_BACK)); | 384 rb->GetImageSkiaNamed(IDR_BACK)); |
380 back_button_->SetImage(views::ImageButton::STATE_HOVERED, | 385 back_button_->SetImage(views::ImageButton::STATE_HOVERED, |
381 rb->GetImageSkiaNamed(IDR_BACK_H)); | 386 rb->GetImageSkiaNamed(IDR_BACK_H)); |
382 back_button_->SetImage(views::ImageButton::STATE_PRESSED, | 387 back_button_->SetImage(views::ImageButton::STATE_PRESSED, |
383 rb->GetImageSkiaNamed(IDR_BACK_P)); | 388 rb->GetImageSkiaNamed(IDR_BACK_P)); |
384 back_button_->SetImage(views::ImageButton::STATE_DISABLED, | 389 back_button_->SetImage(views::ImageButton::STATE_DISABLED, |
385 rb->GetImageSkiaNamed(IDR_BACK_D)); | 390 rb->GetImageSkiaNamed(IDR_BACK_D)); |
386 *back_button = back_button_; | 391 *back_button = back_button_; |
387 | 392 |
388 title_label_ = new views::Label(l10n_util::GetStringUTF16(message_id)); | 393 title_label_ = new views::Label(message); |
389 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 394 title_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
390 const gfx::FontList& medium_font_list = | 395 const gfx::FontList& medium_font_list = |
391 rb->GetFontList(ui::ResourceBundle::MediumFont); | 396 rb->GetFontList(ui::ResourceBundle::MediumFont); |
392 title_label_->SetFontList(medium_font_list); | 397 title_label_->SetFontList(medium_font_list); |
393 | 398 |
394 AddChildView(back_button_); | 399 AddChildView(back_button_); |
395 AddChildView(title_label_); | 400 AddChildView(title_label_); |
396 } | 401 } |
397 | 402 |
398 // Creates a new view that has the |title_card| with padding at the top, an | 403 // Creates a new view that has the |title_card| with padding at the top, an |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 ProfileOAuth2TokenService* oauth2_token_service = | 521 ProfileOAuth2TokenService* oauth2_token_service = |
517 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); | 522 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); |
518 if (oauth2_token_service) | 523 if (oauth2_token_service) |
519 oauth2_token_service->RemoveObserver(this); | 524 oauth2_token_service->RemoveObserver(this); |
520 } | 525 } |
521 | 526 |
522 void ProfileChooserView::ResetView() { | 527 void ProfileChooserView::ResetView() { |
523 open_other_profile_indexes_map_.clear(); | 528 open_other_profile_indexes_map_.clear(); |
524 delete_account_button_map_.clear(); | 529 delete_account_button_map_.clear(); |
525 reauth_account_button_map_.clear(); | 530 reauth_account_button_map_.clear(); |
526 tutorial_learn_more_link_ = NULL; | |
527 tutorial_ok_button_ = NULL; | |
528 tutorial_enable_new_profile_management_button_ = NULL; | |
529 tutorial_end_preview_link_ = NULL; | |
530 tutorial_send_feedback_button_ = NULL; | |
531 manage_accounts_link_ = NULL; | 531 manage_accounts_link_ = NULL; |
532 signin_current_profile_link_ = NULL; | 532 signin_current_profile_link_ = NULL; |
533 question_mark_button_ = NULL; | |
534 auth_error_email_button_ = NULL; | 533 auth_error_email_button_ = NULL; |
535 current_profile_photo_ = NULL; | 534 current_profile_photo_ = NULL; |
536 current_profile_name_ = NULL; | 535 current_profile_name_ = NULL; |
537 users_button_ = NULL; | 536 users_button_ = NULL; |
538 go_incognito_button_ = NULL; | 537 go_incognito_button_ = NULL; |
539 lock_button_ = NULL; | 538 lock_button_ = NULL; |
540 add_account_link_ = NULL; | 539 add_account_link_ = NULL; |
541 gaia_signin_cancel_button_ = NULL; | 540 gaia_signin_cancel_button_ = NULL; |
542 remove_account_button_ = NULL; | 541 remove_account_button_ = NULL; |
543 account_removal_cancel_button_ = NULL; | 542 account_removal_cancel_button_ = NULL; |
544 end_preview_and_relaunch_button_ = NULL; | 543 add_person_button_ = NULL; |
545 end_preview_cancel_button_ = NULL; | 544 disconnect_button_ = NULL; |
| 545 switch_user_cancel_button_ = NULL; |
| 546 tutorial_sync_settings_ok_button_ = NULL; |
| 547 tutorial_sync_settings_link_ = NULL; |
| 548 tutorial_see_whats_new_button_ = NULL; |
| 549 tutorial_not_you_link_ = NULL; |
546 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; | 550 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
547 } | 551 } |
548 | 552 |
549 void ProfileChooserView::Init() { | 553 void ProfileChooserView::Init() { |
550 // If view mode is PROFILE_CHOOSER but there is an auth error, force | 554 // If view mode is PROFILE_CHOOSER but there is an auth error, force |
551 // ACCOUNT_MANAGEMENT mode. | 555 // ACCOUNT_MANAGEMENT mode. |
552 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && | 556 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && |
553 HasAuthError(browser_->profile()) && | 557 HasAuthError(browser_->profile()) && |
554 switches::IsEnableAccountConsistency() && | 558 switches::IsEnableAccountConsistency() && |
555 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()). | 559 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()). |
556 signed_in) { | 560 signed_in) { |
557 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 561 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
558 } | 562 } |
559 | 563 |
560 ShowView(view_mode_, avatar_menu_.get()); | 564 ShowView(view_mode_, avatar_menu_.get()); |
561 } | 565 } |
562 | 566 |
563 void ProfileChooserView::OnAvatarMenuChanged( | 567 void ProfileChooserView::OnAvatarMenuChanged( |
564 AvatarMenu* avatar_menu) { | 568 AvatarMenu* avatar_menu) { |
| 569 // Do not refresh the avatar menu if the user is on a signin related view. |
| 570 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
| 571 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
| 572 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { |
| 573 return; |
| 574 } |
| 575 |
565 // Refresh the view with the new menu. We can't just update the local copy | 576 // Refresh the view with the new menu. We can't just update the local copy |
566 // as this may have been triggered by a sign out action, in which case | 577 // as this may have been triggered by a sign out action, in which case |
567 // the view is being destroyed. | 578 // the view is being destroyed. |
568 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu); | 579 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu); |
569 } | 580 } |
570 | 581 |
571 void ProfileChooserView::OnRefreshTokenAvailable( | 582 void ProfileChooserView::OnRefreshTokenAvailable( |
572 const std::string& account_id) { | 583 const std::string& account_id) { |
573 // Refresh the account management view when a new account is added to the | |
574 // profile. | |
575 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || | 584 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || |
576 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 585 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
577 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 586 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
578 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { | 587 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { |
| 588 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN) |
| 589 tutorial_mode_ = profiles::TUTORIAL_MODE_CONFIRM_SIGNIN; |
579 // The account management UI is only available through the | 590 // The account management UI is only available through the |
580 // --enable-account-consistency flag. | 591 // --enable-account-consistency flag. |
581 ShowView(switches::IsEnableAccountConsistency() ? | 592 ShowView(switches::IsEnableAccountConsistency() ? |
582 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 593 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : |
583 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 594 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
584 } | 595 } |
585 } | 596 } |
586 | 597 |
587 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { | 598 void ProfileChooserView::OnRefreshTokenRevoked(const std::string& account_id) { |
588 // Refresh the account management view when an account is removed from the | 599 // Refresh the account management view when an account is removed from the |
589 // profile. | 600 // profile. |
590 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) | 601 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) |
591 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 602 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
592 } | 603 } |
593 | 604 |
594 void ProfileChooserView::ShowView(profiles::BubbleViewMode view_to_display, | 605 void ProfileChooserView::ShowView(profiles::BubbleViewMode view_to_display, |
595 AvatarMenu* avatar_menu) { | 606 AvatarMenu* avatar_menu) { |
596 // The account management view should only be displayed if the active profile | 607 // The account management view should only be displayed if the active profile |
597 // is signed in. | 608 // is signed in. |
| 609 const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( |
| 610 avatar_menu->GetActiveProfileIndex()); |
598 if (view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { | 611 if (view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
599 DCHECK(switches::IsEnableAccountConsistency()); | 612 DCHECK(switches::IsEnableAccountConsistency()); |
600 const AvatarMenu::Item& active_item = avatar_menu->GetItemAt( | |
601 avatar_menu->GetActiveProfileIndex()); | |
602 DCHECK(active_item.signed_in); | 613 DCHECK(active_item.signed_in); |
603 } | 614 } |
604 | 615 |
605 if (browser_->profile()->IsSupervised() && | 616 if (browser_->profile()->IsSupervised() && |
606 (view_to_display == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 617 (view_to_display == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
607 view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL)) { | 618 view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL)) { |
608 LOG(WARNING) << "Supervised user attempted to add/remove account"; | 619 LOG(WARNING) << "Supervised user attempted to add/remove account"; |
609 return; | 620 return; |
610 } | 621 } |
611 | 622 |
612 // Records the last tutorial mode. | 623 // Records the last tutorial mode. |
613 profiles::TutorialMode last_tutorial_mode = tutorial_mode_; | 624 profiles::TutorialMode last_tutorial_mode = tutorial_mode_; |
614 ResetView(); | 625 ResetView(); |
615 RemoveAllChildViews(true); | 626 RemoveAllChildViews(true); |
616 view_mode_ = view_to_display; | 627 view_mode_ = view_to_display; |
617 | 628 |
618 views::GridLayout* layout; | 629 views::GridLayout* layout; |
619 views::View* sub_view; | 630 views::View* sub_view; |
620 switch (view_mode_) { | 631 switch (view_mode_) { |
621 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: | 632 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
622 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: | 633 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: |
623 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: | 634 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: |
624 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); | 635 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); |
625 sub_view = CreateGaiaSigninView(); | 636 sub_view = CreateGaiaSigninView(); |
626 break; | 637 break; |
627 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: | 638 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
628 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); | 639 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); |
629 sub_view = CreateAccountRemovalView(); | 640 sub_view = CreateAccountRemovalView(); |
630 break; | 641 break; |
631 case profiles::BUBBLE_VIEW_MODE_END_PREVIEW: | 642 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: |
632 layout = CreateSingleColumnLayout(this, kFixedEndPreviewViewWidth); | 643 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); |
633 sub_view = CreateEndPreviewView(); | 644 sub_view = CreateSwitchUserView(active_item); |
634 break; | 645 break; |
635 default: | 646 default: |
636 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); | 647 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); |
637 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode); | 648 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode); |
638 } | 649 } |
639 layout->StartRow(1, 0); | 650 layout->StartRow(1, 0); |
640 layout->AddView(sub_view); | 651 layout->AddView(sub_view); |
641 Layout(); | 652 Layout(); |
642 if (GetBubbleFrameView()) | 653 if (GetBubbleFrameView()) |
643 SizeToContents(); | 654 SizeToContents(); |
644 } | 655 } |
645 | 656 |
646 void ProfileChooserView::WindowClosing() { | 657 void ProfileChooserView::WindowClosing() { |
647 DCHECK_EQ(profile_bubble_, this); | 658 DCHECK_EQ(profile_bubble_, this); |
648 profile_bubble_ = NULL; | 659 profile_bubble_ = NULL; |
| 660 |
| 661 if (tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { |
| 662 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 663 SyncConfirmationUIClosed(false /* configure_sync_first */); |
| 664 } |
649 } | 665 } |
650 | 666 |
651 void ProfileChooserView::ButtonPressed(views::Button* sender, | 667 void ProfileChooserView::ButtonPressed(views::Button* sender, |
652 const ui::Event& event) { | 668 const ui::Event& event) { |
653 // Disable button after clicking so that it doesn't get clicked twice and | 669 // Disable button after clicking so that it doesn't get clicked twice and |
654 // start a second action... which can crash Chrome. But don't disable if it | 670 // start a second action... which can crash Chrome. But don't disable if it |
655 // has no parent (like in tests) because that will also crash. | 671 // has no parent (like in tests) because that will also crash. |
656 if (sender->parent()) | 672 if (sender->parent()) |
657 sender->SetEnabled(false); | 673 sender->SetEnabled(false); |
658 | 674 |
659 if (sender == users_button_) { | 675 if (sender == users_button_) { |
660 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); | 676 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
661 // If this is a guest session, also close all the guest browser windows. | 677 // If this is a guest session, also close all the guest browser windows. |
662 if (browser_->profile()->IsGuestSession()) | 678 if (browser_->profile()->IsGuestSession()) |
663 profiles::CloseGuestProfileWindows(); | 679 profiles::CloseGuestProfileWindows(); |
664 } else if (sender == go_incognito_button_) { | 680 } else if (sender == go_incognito_button_) { |
665 DCHECK(ShouldShowGoIncognito()); | 681 DCHECK(ShouldShowGoIncognito()); |
666 chrome::NewIncognitoWindow(browser_); | 682 chrome::NewIncognitoWindow(browser_); |
667 } else if (sender == lock_button_) { | 683 } else if (sender == lock_button_) { |
668 profiles::LockProfile(browser_->profile()); | 684 profiles::LockProfile(browser_->profile()); |
669 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 685 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
670 } else if (sender == auth_error_email_button_) { | 686 } else if (sender == auth_error_email_button_) { |
671 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); | 687 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); |
672 } else if (sender == tutorial_ok_button_) { | 688 } else if (sender == tutorial_sync_settings_ok_button_) { |
673 // If the user manually dismissed the tutorial, never show it again by | 689 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
674 // setting the number of times shown to the maximum plus 1, so that later we | 690 SyncConfirmationUIClosed(false /* configure_sync_first */); |
675 // could distinguish between the dismiss case and the case when the tutorial | 691 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
676 // is indeed shown for the maximum number of times. | |
677 browser_->profile()->GetPrefs()->SetInteger( | |
678 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); | |
679 | |
680 ProfileMetrics::LogProfileUpgradeEnrollment( | |
681 ProfileMetrics::PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD); | |
682 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 692 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
683 } else if (sender == tutorial_enable_new_profile_management_button_) { | 693 } else if (sender == tutorial_see_whats_new_button_) { |
684 ProfileMetrics::LogProfileUpgradeEnrollment( | 694 chrome::ShowUserManagerWithTutorial( |
685 ProfileMetrics::PROFILE_ENROLLMENT_ACCEPT_NEW_PROFILE_MGMT); | 695 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
686 profiles::EnableNewProfileManagementPreview(browser_->profile()); | |
687 } else if (sender == remove_account_button_) { | 696 } else if (sender == remove_account_button_) { |
688 RemoveAccount(); | 697 RemoveAccount(); |
689 } else if (sender == account_removal_cancel_button_) { | 698 } else if (sender == account_removal_cancel_button_) { |
690 account_id_to_remove_.clear(); | 699 account_id_to_remove_.clear(); |
691 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 700 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
692 } else if (sender == gaia_signin_cancel_button_) { | 701 } else if (sender == gaia_signin_cancel_button_) { |
693 std::string primary_account = | 702 std::string primary_account = |
694 SigninManagerFactory::GetForProfile(browser_->profile())-> | 703 SigninManagerFactory::GetForProfile(browser_->profile())-> |
695 GetAuthenticatedUsername(); | 704 GetAuthenticatedUsername(); |
696 // The account management view is only available with the | 705 // The account management view is only available with the |
697 // --enable-account-consistency flag. | 706 // --enable-account-consistency flag. |
698 bool account_management_available = !primary_account.empty() && | 707 bool account_management_available = !primary_account.empty() && |
699 switches::IsEnableAccountConsistency(); | 708 switches::IsEnableAccountConsistency(); |
700 ShowView(account_management_available ? | 709 ShowView(account_management_available ? |
701 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 710 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : |
702 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 711 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
703 } else if (sender == question_mark_button_) { | |
704 tutorial_mode_ = profiles::TUTORIAL_MODE_SEND_FEEDBACK; | |
705 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | |
706 } else if (sender == tutorial_send_feedback_button_) { | |
707 ProfileMetrics::LogProfileUpgradeEnrollment( | |
708 ProfileMetrics::PROFILE_ENROLLMENT_SEND_FEEDBACK); | |
709 chrome::OpenFeedbackDialog(browser_); | |
710 } else if (sender == end_preview_and_relaunch_button_) { | |
711 ProfileMetrics::LogProfileUpgradeEnrollment( | |
712 ProfileMetrics::PROFILE_ENROLLMENT_DISABLE_NEW_PROFILE_MGMT); | |
713 profiles::DisableNewProfileManagementPreview(browser_->profile()); | |
714 } else if (sender == end_preview_cancel_button_) { | |
715 tutorial_mode_ = profiles::TUTORIAL_MODE_SEND_FEEDBACK; | |
716 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | |
717 } else if (current_profile_photo_ && | 712 } else if (current_profile_photo_ && |
718 sender == current_profile_photo_->change_photo_button()) { | 713 sender == current_profile_photo_->change_photo_button()) { |
719 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); | 714 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
720 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); | 715 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); |
721 } else if (sender == signin_current_profile_link_) { | 716 } else if (sender == signin_current_profile_link_) { |
722 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); | 717 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); |
| 718 } else if (sender == add_person_button_) { |
| 719 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
| 720 } else if (sender == disconnect_button_) { |
| 721 chrome::ShowSettings(browser_); |
| 722 } else if (sender == switch_user_cancel_button_) { |
| 723 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
723 } else { | 724 } else { |
724 // Either one of the "other profiles", or one of the profile accounts | 725 // Either one of the "other profiles", or one of the profile accounts |
725 // buttons was pressed. | 726 // buttons was pressed. |
726 ButtonIndexes::const_iterator profile_match = | 727 ButtonIndexes::const_iterator profile_match = |
727 open_other_profile_indexes_map_.find(sender); | 728 open_other_profile_indexes_map_.find(sender); |
728 if (profile_match != open_other_profile_indexes_map_.end()) { | 729 if (profile_match != open_other_profile_indexes_map_.end()) { |
729 avatar_menu_->SwitchToProfile( | 730 avatar_menu_->SwitchToProfile( |
730 profile_match->second, | 731 profile_match->second, |
731 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, | 732 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, |
732 ProfileMetrics::SWITCH_PROFILE_ICON); | 733 ProfileMetrics::SWITCH_PROFILE_ICON); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // depending on which view it is displayed. ShowView() will DCHECK if | 768 // depending on which view it is displayed. ShowView() will DCHECK if |
768 // the account management view is displayed for non signed-in users. | 769 // the account management view is displayed for non signed-in users. |
769 ShowView( | 770 ShowView( |
770 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? | 771 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? |
771 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : | 772 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
772 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, | 773 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, |
773 avatar_menu_.get()); | 774 avatar_menu_.get()); |
774 } else if (sender == add_account_link_) { | 775 } else if (sender == add_account_link_) { |
775 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); | 776 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); |
776 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT); | 777 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT); |
777 } else if (sender == tutorial_learn_more_link_) { | 778 } else if (sender == tutorial_sync_settings_link_) { |
778 ProfileMetrics::LogProfileUpgradeEnrollment( | 779 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
779 ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE); | 780 SyncConfirmationUIClosed(true /* configure_sync_first */); |
780 // TODO(guohui): update |learn_more_url| once it is decided. | 781 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
781 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); | |
782 chrome::NavigateParams params( | |
783 browser_->profile(), | |
784 lear_more_url, | |
785 content::PAGE_TRANSITION_LINK); | |
786 params.disposition = NEW_FOREGROUND_TAB; | |
787 chrome::Navigate(¶ms); | |
788 } else { | 782 } else { |
789 DCHECK(sender == tutorial_end_preview_link_); | 783 DCHECK(sender == tutorial_not_you_link_); |
790 ShowView(profiles::BUBBLE_VIEW_MODE_END_PREVIEW, avatar_menu_.get()); | 784 ShowView(profiles::BUBBLE_VIEW_MODE_SWITCH_USER, avatar_menu_.get()); |
791 } | 785 } |
792 } | 786 } |
793 | 787 |
794 void ProfileChooserView::StyledLabelLinkClicked( | 788 void ProfileChooserView::StyledLabelLinkClicked( |
795 const gfx::Range& range, int event_flags) { | 789 const gfx::Range& range, int event_flags) { |
796 chrome::ShowSettings(browser_); | 790 chrome::ShowSettings(browser_); |
797 } | 791 } |
798 | 792 |
799 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, | 793 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, |
800 const ui::KeyEvent& key_event) { | 794 const ui::KeyEvent& key_event) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 // profile management preview is enabled or not. | 827 // profile management preview is enabled or not. |
834 | 828 |
835 views::View* view = new views::View(); | 829 views::View* view = new views::View(); |
836 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); | 830 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); |
837 // Separate items into active and alternatives. | 831 // Separate items into active and alternatives. |
838 Indexes other_profiles; | 832 Indexes other_profiles; |
839 views::View* tutorial_view = NULL; | 833 views::View* tutorial_view = NULL; |
840 views::View* current_profile_view = NULL; | 834 views::View* current_profile_view = NULL; |
841 views::View* current_profile_accounts = NULL; | 835 views::View* current_profile_accounts = NULL; |
842 views::View* option_buttons_view = NULL; | 836 views::View* option_buttons_view = NULL; |
843 bool is_enable_account_consistency = switches::IsEnableAccountConsistency(); | |
844 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { | 837 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { |
845 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); | 838 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); |
846 if (item.active) { | 839 if (item.active) { |
847 option_buttons_view = CreateOptionsView( | 840 option_buttons_view = CreateOptionsView( |
848 switches::IsNewProfileManagement() && item.signed_in); | 841 switches::IsNewProfileManagement() && item.signed_in); |
849 current_profile_view = CreateCurrentProfileView(item, false); | 842 current_profile_view = CreateCurrentProfileView(item, false); |
850 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { | 843 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
851 if (is_enable_account_consistency) { | 844 switch (last_tutorial_mode) { |
852 tutorial_view = | 845 case profiles::TUTORIAL_MODE_NONE: |
853 last_tutorial_mode == profiles::TUTORIAL_MODE_SEND_FEEDBACK ? | 846 case profiles::TUTORIAL_MODE_WELCOME_UPGRADE: |
854 CreateSendPreviewFeedbackView() : | 847 tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded( |
855 CreatePreviewEnabledTutorialView( | 848 last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME_UPGRADE, |
856 item, last_tutorial_mode == profiles::TUTORIAL_MODE_WELCOME); | 849 item); |
| 850 break; |
| 851 case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN: |
| 852 tutorial_view = CreateSigninConfirmationView(); |
| 853 break; |
| 854 case profiles::TUTORIAL_MODE_SHOW_ERROR: |
| 855 // TODO(guohui): not implemented yet. |
| 856 NOTREACHED(); |
857 } | 857 } |
858 } else { | 858 } else { |
859 current_profile_accounts = CreateCurrentProfileAccountsView(item); | 859 current_profile_accounts = CreateCurrentProfileAccountsView(item); |
860 } | 860 } |
861 } else { | 861 } else { |
862 other_profiles.push_back(i); | 862 other_profiles.push_back(i); |
863 } | 863 } |
864 } | 864 } |
865 | 865 |
866 if (tutorial_view) { | 866 if (tutorial_view) { |
867 // Be sure not to track the tutorial display on View refresh, and only count | 867 // TODO(mlerman): update UMA stats for the new tutorial. |
868 // the preview-promo view, shown when New Profile Management is off. | |
869 if (tutorial_mode_ != last_tutorial_mode && | |
870 !is_enable_account_consistency) { | |
871 ProfileMetrics::LogProfileUpgradeEnrollment( | |
872 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO); | |
873 } | |
874 layout->StartRow(1, 0); | 868 layout->StartRow(1, 0); |
875 layout->AddView(tutorial_view); | 869 layout->AddView(tutorial_view); |
876 } | 870 } |
877 | 871 |
878 if (!current_profile_view) { | 872 if (!current_profile_view) { |
879 // Guest windows don't have an active profile. | 873 // Guest windows don't have an active profile. |
880 current_profile_view = CreateGuestProfileView(); | 874 current_profile_view = CreateGuestProfileView(); |
881 option_buttons_view = CreateOptionsView(false); | 875 option_buttons_view = CreateOptionsView(false); |
882 } | 876 } |
883 | 877 |
(...skipping 25 matching lines...) Expand all Loading... |
909 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 903 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
910 | 904 |
911 if (option_buttons_view) { | 905 if (option_buttons_view) { |
912 layout->StartRow(0, 0); | 906 layout->StartRow(0, 0); |
913 layout->AddView(option_buttons_view); | 907 layout->AddView(option_buttons_view); |
914 } | 908 } |
915 | 909 |
916 return view; | 910 return view; |
917 } | 911 } |
918 | 912 |
919 views::View* ProfileChooserView::CreatePreviewEnabledTutorialView( | |
920 const AvatarMenu::Item& current_avatar_item, | |
921 bool tutorial_shown) { | |
922 if (!switches::IsNewProfileManagementPreviewEnabled()) | |
923 return NULL; | |
924 | |
925 Profile* profile = browser_->profile(); | |
926 const int show_count = profile->GetPrefs()->GetInteger( | |
927 prefs::kProfileAvatarTutorialShown); | |
928 // Do not show the tutorial if user has dismissed it. | |
929 if (show_count > kProfileAvatarTutorialShowMax) | |
930 return NULL; | |
931 | |
932 if (!tutorial_shown) { | |
933 if (show_count == kProfileAvatarTutorialShowMax) | |
934 return NULL; | |
935 profile->GetPrefs()->SetInteger( | |
936 prefs::kProfileAvatarTutorialShown, show_count + 1); | |
937 } | |
938 | |
939 return CreateTutorialView( | |
940 profiles::TUTORIAL_MODE_WELCOME, | |
941 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE), | |
942 l10n_util::GetStringUTF16( | |
943 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT), | |
944 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), | |
945 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), | |
946 &tutorial_learn_more_link_, | |
947 &tutorial_ok_button_); | |
948 } | |
949 | |
950 views::View* ProfileChooserView::CreateSendPreviewFeedbackView() { | |
951 return CreateTutorialView( | |
952 profiles::TUTORIAL_MODE_SEND_FEEDBACK, | |
953 l10n_util::GetStringUTF16(IDS_PROFILES_FEEDBACK_TUTORIAL_TITLE), | |
954 l10n_util::GetStringUTF16( | |
955 IDS_PROFILES_FEEDBACK_TUTORIAL_CONTENT_TEXT), | |
956 l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW), | |
957 l10n_util::GetStringUTF16(IDS_PROFILES_SEND_FEEDBACK_BUTTON), | |
958 &tutorial_end_preview_link_, | |
959 &tutorial_send_feedback_button_); | |
960 } | |
961 | |
962 views::View* ProfileChooserView::CreateTutorialView( | 913 views::View* ProfileChooserView::CreateTutorialView( |
963 profiles::TutorialMode tutorial_mode, | 914 profiles::TutorialMode tutorial_mode, |
964 const base::string16& title_text, | 915 const base::string16& title_text, |
965 const base::string16& content_text, | 916 const base::string16& content_text, |
966 const base::string16& link_text, | 917 const base::string16& link_text, |
967 const base::string16& button_text, | 918 const base::string16& button_text, |
968 views::Link** link, | 919 views::Link** link, |
969 views::LabelButton** button) { | 920 views::LabelButton** button) { |
970 tutorial_mode_ = tutorial_mode; | 921 tutorial_mode_ = tutorial_mode; |
971 | 922 |
(...skipping 20 matching lines...) Expand all Loading... |
992 // Adds body content. | 943 // Adds body content. |
993 views::Label* content_label = new views::Label(content_text); | 944 views::Label* content_label = new views::Label(content_text); |
994 content_label->SetMultiLine(true); | 945 content_label->SetMultiLine(true); |
995 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 946 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
996 content_label->SetAutoColorReadabilityEnabled(false); | 947 content_label->SetAutoColorReadabilityEnabled(false); |
997 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); | 948 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); |
998 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 949 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); |
999 layout->AddView(content_label); | 950 layout->AddView(content_label); |
1000 | 951 |
1001 // Adds links and buttons. | 952 // Adds links and buttons. |
1002 views::View* button_row = new views::View(); | 953 views::ColumnSet* button_columns = layout->AddColumnSet(1); |
1003 views::GridLayout* button_layout = new views::GridLayout(button_row); | |
1004 views::ColumnSet* button_columns = button_layout->AddColumnSet(0); | |
1005 button_columns->AddColumn(views::GridLayout::LEADING, | 954 button_columns->AddColumn(views::GridLayout::LEADING, |
1006 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 955 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
1007 button_columns->AddPaddingColumn( | 956 button_columns->AddPaddingColumn( |
1008 1, views::kUnrelatedControlHorizontalSpacing); | 957 1, views::kUnrelatedControlHorizontalSpacing); |
1009 button_columns->AddColumn(views::GridLayout::TRAILING, | 958 button_columns->AddColumn(views::GridLayout::TRAILING, |
1010 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 959 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
1011 button_row->SetLayoutManager(button_layout); | |
1012 | 960 |
1013 *link = CreateLink(link_text, this); | 961 *link = CreateLink(link_text, this); |
1014 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 962 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1015 (*link)->SetAutoColorReadabilityEnabled(false); | 963 (*link)->SetAutoColorReadabilityEnabled(false); |
1016 (*link)->SetEnabledColor(SK_ColorWHITE); | 964 (*link)->SetEnabledColor(SK_ColorWHITE); |
1017 button_layout->StartRow(1, 0); | 965 layout->StartRowWithPadding(1, 1, 0, views::kUnrelatedControlVerticalSpacing); |
1018 button_layout->AddView(*link); | 966 layout->AddView(*link); |
1019 | 967 |
1020 *button = new views::LabelButton(this, button_text); | 968 *button = new views::LabelButton(this, button_text); |
1021 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 969 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
1022 (*button)->SetStyle(views::Button::STYLE_BUTTON); | 970 (*button)->SetStyle(views::Button::STYLE_BUTTON); |
1023 button_layout->AddView(*button); | 971 layout->AddView(*button); |
1024 | 972 |
1025 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 973 return view; |
1026 layout->AddView(button_row); | |
1027 | |
1028 // Adds a padded caret image at the bottom. | |
1029 views::View* padded_caret_view = new views::View(); | |
1030 views::GridLayout* padded_caret_layout = | |
1031 new views::GridLayout(padded_caret_view); | |
1032 views::ColumnSet* padded_columns = padded_caret_layout->AddColumnSet(0); | |
1033 padded_columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); | |
1034 padded_columns->AddColumn(views::GridLayout::LEADING, | |
1035 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | |
1036 padded_caret_view->SetLayoutManager(padded_caret_layout); | |
1037 | |
1038 views::ImageView* caret_image_view = new views::ImageView(); | |
1039 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | |
1040 caret_image_view->SetImage( | |
1041 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_CARET)); | |
1042 | |
1043 padded_caret_layout->StartRow(1, 0); | |
1044 padded_caret_layout->AddView(caret_image_view); | |
1045 | |
1046 views::View* view_with_caret = new views::View(); | |
1047 views::GridLayout* layout_with_caret = | |
1048 CreateSingleColumnLayout(view_with_caret, kFixedMenuWidth); | |
1049 layout_with_caret->StartRow(1, 0); | |
1050 layout_with_caret->AddView(view); | |
1051 layout_with_caret->StartRow(1, 0); | |
1052 layout_with_caret->AddView(padded_caret_view); | |
1053 return view_with_caret; | |
1054 } | 974 } |
1055 | 975 |
1056 views::View* ProfileChooserView::CreateCurrentProfileView( | 976 views::View* ProfileChooserView::CreateCurrentProfileView( |
1057 const AvatarMenu::Item& avatar_item, | 977 const AvatarMenu::Item& avatar_item, |
1058 bool is_guest) { | 978 bool is_guest) { |
1059 views::View* view = new views::View(); | 979 views::View* view = new views::View(); |
1060 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; | 980 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; |
1061 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); | 981 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); |
1062 layout->SetInsets(views::kButtonVEdgeMarginNew, | 982 layout->SetInsets(views::kButtonVEdgeMarginNew, |
1063 views::kButtonHEdgeMarginNew, | 983 views::kButtonHEdgeMarginNew, |
1064 views::kUnrelatedControlVerticalSpacing, | 984 views::kUnrelatedControlVerticalSpacing, |
1065 views::kButtonHEdgeMarginNew); | 985 views::kButtonHEdgeMarginNew); |
1066 | 986 |
1067 // Profile icon, centered. | 987 // Profile icon, centered. |
1068 int x_offset = (column_width - kLargeImageSide) / 2; | 988 int x_offset = (column_width - kLargeImageSide) / 2; |
1069 current_profile_photo_ = new EditableProfilePhoto( | 989 current_profile_photo_ = new EditableProfilePhoto( |
1070 this, avatar_item.icon, !is_guest, | 990 this, avatar_item.icon, !is_guest, |
1071 gfx::Rect(x_offset, 0, kLargeImageSide, kLargeImageSide)); | 991 gfx::Rect(x_offset, 0, kLargeImageSide, kLargeImageSide)); |
1072 SizedContainer* profile_icon_container = | 992 SizedContainer* profile_icon_container = |
1073 new SizedContainer(gfx::Size(column_width, kLargeImageSide)); | 993 new SizedContainer(gfx::Size(column_width, kLargeImageSide)); |
1074 profile_icon_container->AddChildView(current_profile_photo_); | 994 profile_icon_container->AddChildView(current_profile_photo_); |
1075 | 995 |
1076 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 996 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1077 if (switches::IsNewProfileManagementPreviewEnabled()) { | |
1078 question_mark_button_ = new views::ImageButton(this); | |
1079 question_mark_button_->SetImageAlignment( | |
1080 views::ImageButton::ALIGN_LEFT, views::ImageButton::ALIGN_MIDDLE); | |
1081 question_mark_button_->SetImage(views::ImageButton::STATE_NORMAL, | |
1082 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_STABLE)); | |
1083 question_mark_button_->SetImage(views::ImageButton::STATE_HOVERED, | |
1084 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_HOVER)); | |
1085 question_mark_button_->SetImage(views::ImageButton::STATE_PRESSED, | |
1086 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_QUESTION_SELECT)); | |
1087 gfx::Size preferred_size = question_mark_button_->GetPreferredSize(); | |
1088 question_mark_button_->SetBounds( | |
1089 0, 0, preferred_size.width(), preferred_size.height()); | |
1090 profile_icon_container->AddChildView(question_mark_button_); | |
1091 } | |
1092 | |
1093 if (browser_->profile()->IsSupervised()) { | 997 if (browser_->profile()->IsSupervised()) { |
1094 views::ImageView* supervised_icon = new views::ImageView(); | 998 views::ImageView* supervised_icon = new views::ImageView(); |
1095 supervised_icon->SetImage( | 999 supervised_icon->SetImage( |
1096 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED)); | 1000 rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_SUPERVISED)); |
1097 gfx::Size preferred_size = supervised_icon->GetPreferredSize(); | 1001 gfx::Size preferred_size = supervised_icon->GetPreferredSize(); |
1098 gfx::Rect parent_bounds = current_profile_photo_->bounds(); | 1002 gfx::Rect parent_bounds = current_profile_photo_->bounds(); |
1099 supervised_icon->SetBounds( | 1003 supervised_icon->SetBounds( |
1100 parent_bounds.right() - preferred_size.width(), | 1004 parent_bounds.right() - preferred_size.width(), |
1101 parent_bounds.bottom() - preferred_size.height(), | 1005 parent_bounds.bottom() - preferred_size.height(), |
1102 preferred_size.width(), | 1006 preferred_size.width(), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 views::LabelButton::STATE_NORMAL, | 1051 views::LabelButton::STATE_NORMAL, |
1148 views::Link::GetDefaultEnabledColor()); | 1052 views::Link::GetDefaultEnabledColor()); |
1149 layout->AddView(auth_error_email_button_); | 1053 layout->AddView(auth_error_email_button_); |
1150 } else { | 1054 } else { |
1151 views::Label* email_label = new views::Label(avatar_item.sync_state); | 1055 views::Label* email_label = new views::Label(avatar_item.sync_state); |
1152 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); | 1056 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); |
1153 layout->AddView(email_label); | 1057 layout->AddView(email_label); |
1154 } | 1058 } |
1155 } | 1059 } |
1156 } else { | 1060 } else { |
1157 SigninManagerBase* signin_manager = | 1061 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile( |
1158 SigninManagerFactory::GetForProfile( | 1062 browser_->profile()->GetOriginalProfile()); |
1159 browser_->profile()->GetOriginalProfile()); | |
1160 if (signin_manager->IsSigninAllowed()) { | 1063 if (signin_manager->IsSigninAllowed()) { |
1161 views::Label* promo = new views::Label( | 1064 views::Label* promo = new views::Label( |
1162 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO)); | 1065 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO)); |
1163 promo->SetMultiLine(true); | 1066 promo->SetMultiLine(true); |
1164 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1067 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1165 layout->StartRowWithPadding(1, 0, 0, | 1068 layout->StartRowWithPadding(1, 0, 0, |
1166 views::kRelatedControlSmallVerticalSpacing); | 1069 views::kRelatedControlSmallVerticalSpacing); |
1167 layout->StartRow(1, 0); | 1070 layout->StartRow(1, 0); |
1168 layout->AddView(promo); | 1071 layout->AddView(promo); |
1169 | 1072 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 return NULL; | 1311 return NULL; |
1409 } | 1312 } |
1410 | 1313 |
1411 // Adds Gaia signin webview | 1314 // Adds Gaia signin webview |
1412 Profile* profile = browser_->profile(); | 1315 Profile* profile = browser_->profile(); |
1413 views::WebView* web_view = new views::WebView(profile); | 1316 views::WebView* web_view = new views::WebView(profile); |
1414 web_view->LoadInitialURL(url); | 1317 web_view->LoadInitialURL(url); |
1415 web_view->SetPreferredSize( | 1318 web_view->SetPreferredSize( |
1416 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 1319 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); |
1417 | 1320 |
1418 TitleCard* title_card = new TitleCard(message_id, this, | 1321 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), |
| 1322 this, |
1419 &gaia_signin_cancel_button_); | 1323 &gaia_signin_cancel_button_); |
1420 return TitleCard::AddPaddedTitleCard( | 1324 return TitleCard::AddPaddedTitleCard( |
1421 web_view, title_card, kFixedGaiaViewWidth); | 1325 web_view, title_card, kFixedGaiaViewWidth); |
1422 } | 1326 } |
1423 | 1327 |
1424 views::View* ProfileChooserView::CreateAccountRemovalView() { | 1328 views::View* ProfileChooserView::CreateAccountRemovalView() { |
1425 views::View* view = new views::View(); | 1329 views::View* view = new views::View(); |
1426 views::GridLayout* layout = CreateSingleColumnLayout( | 1330 views::GridLayout* layout = CreateSingleColumnLayout( |
1427 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); | 1331 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); |
1428 layout->SetInsets(0, | 1332 layout->SetInsets(0, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 this, l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON)); | 1373 this, l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON)); |
1470 remove_account_button_->SetHorizontalAlignment( | 1374 remove_account_button_->SetHorizontalAlignment( |
1471 gfx::ALIGN_CENTER); | 1375 gfx::ALIGN_CENTER); |
1472 layout->StartRowWithPadding( | 1376 layout->StartRowWithPadding( |
1473 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1377 1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1474 layout->AddView(remove_account_button_); | 1378 layout->AddView(remove_account_button_); |
1475 } else { | 1379 } else { |
1476 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 1380 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
1477 } | 1381 } |
1478 | 1382 |
1479 TitleCard* title_card = new TitleCard(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE, | 1383 TitleCard* title_card = new TitleCard( |
| 1384 l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE), |
1480 this, &account_removal_cancel_button_); | 1385 this, &account_removal_cancel_button_); |
1481 return TitleCard::AddPaddedTitleCard(view, title_card, | 1386 return TitleCard::AddPaddedTitleCard(view, title_card, |
1482 kFixedAccountRemovalViewWidth); | 1387 kFixedAccountRemovalViewWidth); |
1483 } | 1388 } |
1484 | 1389 |
1485 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() { | 1390 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded( |
| 1391 bool tutorial_shown, const AvatarMenu::Item& avatar_item){ |
| 1392 if (first_run::IsChromeFirstRun()) |
| 1393 return NULL; |
| 1394 |
| 1395 Profile* profile = browser_->profile(); |
| 1396 if (!avatar_item.signed_in) { |
| 1397 profile->GetPrefs()->SetInteger( |
| 1398 prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1); |
| 1399 return NULL; |
| 1400 } |
| 1401 |
| 1402 const int show_count = profile->GetPrefs()->GetInteger( |
| 1403 prefs::kProfileAvatarTutorialShown); |
| 1404 // Do not show the tutorial if user has dismissed it. |
| 1405 if (show_count > kUpgradeWelcomeTutorialShowMax) |
| 1406 return NULL; |
| 1407 |
| 1408 if (!tutorial_shown) { |
| 1409 if (show_count == kUpgradeWelcomeTutorialShowMax) |
| 1410 return NULL; |
| 1411 profile->GetPrefs()->SetInteger( |
| 1412 prefs::kProfileAvatarTutorialShown, show_count + 1); |
| 1413 } |
| 1414 |
1486 return CreateTutorialView( | 1415 return CreateTutorialView( |
1487 profiles::TUTORIAL_MODE_ENABLE_PREVIEW, | 1416 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, |
1488 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE), | 1417 l10n_util::GetStringFUTF16( |
1489 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT), | 1418 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name), |
1490 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), | 1419 l10n_util::GetStringUTF16( |
1491 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON), | 1420 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), |
1492 &tutorial_learn_more_link_, | 1421 l10n_util::GetStringFUTF16( |
1493 &tutorial_enable_new_profile_management_button_); | 1422 IDS_PROFILES_NOT_YOU, avatar_item.name), |
| 1423 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), |
| 1424 &tutorial_not_you_link_, |
| 1425 &tutorial_see_whats_new_button_); |
1494 } | 1426 } |
1495 | 1427 |
1496 views::View* ProfileChooserView::CreateEndPreviewView() { | 1428 views::View* ProfileChooserView::CreateSigninConfirmationView(){ |
| 1429 return CreateTutorialView( |
| 1430 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, |
| 1431 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), |
| 1432 l10n_util::GetStringUTF16( |
| 1433 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT), |
| 1434 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK), |
| 1435 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), |
| 1436 &tutorial_sync_settings_link_, |
| 1437 &tutorial_sync_settings_ok_button_); |
| 1438 } |
| 1439 |
| 1440 views::View* ProfileChooserView::CreateSwitchUserView( |
| 1441 const AvatarMenu::Item& avatar_item) { |
1497 views::View* view = new views::View(); | 1442 views::View* view = new views::View(); |
1498 views::GridLayout* layout = CreateSingleColumnLayout( | 1443 views::GridLayout* layout = CreateSingleColumnLayout( |
1499 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); | 1444 view, kFixedSwitchUserViewWidth); |
1500 layout->SetInsets(0, | 1445 views::ColumnSet* columns = layout->AddColumnSet(1); |
1501 views::kButtonHEdgeMarginNew, | 1446 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
1502 views::kButtonVEdgeMarginNew, | 1447 int label_width = |
1503 views::kButtonHEdgeMarginNew); | 1448 kFixedSwitchUserViewWidth - 2 * views::kButtonHEdgeMarginNew; |
| 1449 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, |
| 1450 views::GridLayout::FIXED, label_width, label_width); |
| 1451 columns->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
1504 | 1452 |
1505 // Adds main text. | 1453 // Adds main text. |
1506 views::Label* content_label = new views::Label( | 1454 layout->StartRowWithPadding(1, 1, 0, views::kUnrelatedControlVerticalSpacing); |
1507 l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_TEXT)); | |
1508 content_label->SetMultiLine(true); | |
1509 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
1510 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1455 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
1511 const gfx::FontList& small_font_list = | 1456 const gfx::FontList& small_font_list = |
1512 rb->GetFontList(ui::ResourceBundle::SmallFont); | 1457 rb->GetFontList(ui::ResourceBundle::SmallFont); |
| 1458 views::Label* content_label = new views::Label( |
| 1459 l10n_util::GetStringFUTF16( |
| 1460 IDS_PROFILES_NOT_YOU_CONTENT_TEXT, avatar_item.name)); |
| 1461 content_label->SetMultiLine(true); |
| 1462 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1513 content_label->SetFontList(small_font_list); | 1463 content_label->SetFontList(small_font_list); |
1514 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); | |
1515 layout->AddView(content_label); | 1464 layout->AddView(content_label); |
1516 | 1465 |
1517 // Adds button. | 1466 // Adds "Add person" button. |
1518 end_preview_and_relaunch_button_ = new views::BlueButton( | 1467 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); |
1519 this, l10n_util::GetStringUTF16(IDS_PROFILES_END_PREVIEW_AND_RELAUNCH)); | 1468 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
1520 end_preview_and_relaunch_button_->SetHorizontalAlignment( | 1469 |
1521 gfx::ALIGN_CENTER); | 1470 add_person_button_ = new BackgroundColorHoverButton( |
1522 layout->StartRowWithPadding( | 1471 this, |
1523 1, 0, 0, views::kUnrelatedControlVerticalSpacing); | 1472 l10n_util::GetStringUTF16(IDS_PROFILES_ADD_PERSON_BUTTON), |
1524 layout->AddView(end_preview_and_relaunch_button_); | 1473 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR)); |
| 1474 layout->StartRow(1, 0); |
| 1475 layout->AddView(add_person_button_); |
| 1476 |
| 1477 // Adds "Disconnect your Google Account" button. |
| 1478 layout->StartRow(1, 0); |
| 1479 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 1480 |
| 1481 disconnect_button_ = new BackgroundColorHoverButton( |
| 1482 this, |
| 1483 l10n_util::GetStringUTF16(IDS_PROFILES_DISCONNECT_BUTTON), |
| 1484 *rb->GetImageSkiaNamed(IDR_ICON_PROFILES_MENU_AVATAR)); |
| 1485 layout->StartRow(1, 0); |
| 1486 layout->AddView(disconnect_button_); |
1525 | 1487 |
1526 TitleCard* title_card = new TitleCard( | 1488 TitleCard* title_card = new TitleCard( |
1527 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); | 1489 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU, avatar_item.name), |
1528 return TitleCard::AddPaddedTitleCard( | 1490 this, &switch_user_cancel_button_); |
1529 view, title_card, kFixedAccountRemovalViewWidth); | 1491 return TitleCard::AddPaddedTitleCard(view, title_card, |
| 1492 kFixedSwitchUserViewWidth); |
1530 } | 1493 } |
1531 | 1494 |
1532 bool ProfileChooserView::ShouldShowGoIncognito() const { | 1495 bool ProfileChooserView::ShouldShowGoIncognito() const { |
1533 bool incognito_available = | 1496 bool incognito_available = |
1534 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1497 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1535 IncognitoModePrefs::DISABLED; | 1498 IncognitoModePrefs::DISABLED; |
1536 return incognito_available && !browser_->profile()->IsGuestSession(); | 1499 return incognito_available && !browser_->profile()->IsGuestSession(); |
1537 } | 1500 } |
1538 | 1501 |
1539 void ProfileChooserView::PostActionPerformed( | 1502 void ProfileChooserView::PostActionPerformed( |
1540 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1503 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1541 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1504 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1542 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1505 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1543 } | 1506 } |
OLD | NEW |