Chromium Code Reviews| 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/about_flags.h" | 9 #include "chrome/browser/about_flags.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
| 12 #include "chrome/browser/pref_service_flags_storage.h" | 12 #include "chrome/browser/pref_service_flags_storage.h" |
| 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.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_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
| 19 #include "chrome/browser/signin/signin_promo.h" | 20 #include "chrome/browser/signin/signin_promo.h" |
| 20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
| 22 #include "chrome/browser/ui/chrome_pages.h" | 23 #include "chrome/browser/ui/chrome_pages.h" |
| 23 #include "chrome/browser/ui/singleton_tabs.h" | 24 #include "chrome/browser/ui/singleton_tabs.h" |
| 24 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 25 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 profiles::LockProfile(browser_->profile()); | 521 profiles::LockProfile(browser_->profile()); |
| 521 } else if (sender == add_account_button_) { | 522 } else if (sender == add_account_button_) { |
| 522 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); | 523 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); |
| 523 } else if (sender == tutorial_ok_button_) { | 524 } else if (sender == tutorial_ok_button_) { |
| 524 // If the user manually dismissed the tutorial, never show it again by | 525 // If the user manually dismissed the tutorial, never show it again by |
| 525 // setting the number of times shown to the maximum plus 1, so that later we | 526 // setting the number of times shown to the maximum plus 1, so that later we |
| 526 // could distinguish between the dismiss case and the case when the tutorial | 527 // could distinguish between the dismiss case and the case when the tutorial |
| 527 // is indeed shown for the maximum number of times. | 528 // is indeed shown for the maximum number of times. |
| 528 browser_->profile()->GetPrefs()->SetInteger( | 529 browser_->profile()->GetPrefs()->SetInteger( |
| 529 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); | 530 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); |
| 531 | |
| 532 ProfileMetrics::LogProfileMirrorEnrollment(ProfileMetrics::PROMO_DISMISS); | |
|
guohui
2014/04/16 15:47:45
this dismisses the confirmation tutorial, not the
Mike Lerman
2014/04/24 15:14:16
Done.
| |
| 530 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 533 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| 531 } else if (sender == tutorial_enable_new_profile_management_button_) { | 534 } else if (sender == tutorial_enable_new_profile_management_button_) { |
| 532 EnableNewProfileManagementPreview(); | 535 EnableNewProfileManagementPreview(); |
| 533 } else if (sender == remove_account_and_relaunch_button_) { | 536 } else if (sender == remove_account_and_relaunch_button_) { |
| 534 RemoveAccount(); | 537 RemoveAccount(); |
| 535 } else if (sender == account_removal_cancel_button_) { | 538 } else if (sender == account_removal_cancel_button_) { |
| 536 account_id_to_remove_.clear(); | 539 account_id_to_remove_.clear(); |
| 537 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 540 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| 538 } else if (sender == gaia_signin_cancel_button_) { | 541 } else if (sender == gaia_signin_cancel_button_) { |
| 539 std::string primary_account = | 542 std::string primary_account = |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 | 580 |
| 578 chrome::AttemptRestart(); | 581 chrome::AttemptRestart(); |
| 579 } | 582 } |
| 580 | 583 |
| 581 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { | 584 void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { |
| 582 if (sender == manage_accounts_link_) { | 585 if (sender == manage_accounts_link_) { |
| 583 // ShowView() will DCHECK if this view is displayed for non signed-in users. | 586 // ShowView() will DCHECK if this view is displayed for non signed-in users. |
| 584 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 587 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
| 585 } else if (sender == tutorial_learn_more_link_) { | 588 } else if (sender == tutorial_learn_more_link_) { |
| 586 // TODO(guohui): update |learn_more_url| once it is decided. | 589 // TODO(guohui): update |learn_more_url| once it is decided. |
| 590 ProfileMetrics::LogProfileMirrorEnrollment(ProfileMetrics::PROMO_ACCEPT); | |
|
guohui
2014/04/16 15:47:45
the link opens the learn more url, it dose not mea
Mike Lerman
2014/04/24 15:14:16
Renamed. Done.
| |
| 587 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); | 591 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); |
| 588 chrome::NavigateParams params( | 592 chrome::NavigateParams params( |
| 589 browser_->profile(), | 593 browser_->profile(), |
| 590 lear_more_url, | 594 lear_more_url, |
| 591 content::PAGE_TRANSITION_LINK); | 595 content::PAGE_TRANSITION_LINK); |
| 592 params.disposition = NEW_FOREGROUND_TAB; | 596 params.disposition = NEW_FOREGROUND_TAB; |
| 593 chrome::Navigate(¶ms); | 597 chrome::Navigate(¶ms); |
| 594 } else { | 598 } else { |
| 595 DCHECK(sender == signin_current_profile_link_); | 599 DCHECK(sender == signin_current_profile_link_); |
| 596 ShowView(BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); | 600 ShowView(BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 } else { | 660 } else { |
| 657 current_profile_view = CreateCurrentProfileEditableView(item); | 661 current_profile_view = CreateCurrentProfileEditableView(item); |
| 658 current_profile_accounts = CreateCurrentProfileAccountsView(item); | 662 current_profile_accounts = CreateCurrentProfileAccountsView(item); |
| 659 } | 663 } |
| 660 } else { | 664 } else { |
| 661 other_profiles.push_back(i); | 665 other_profiles.push_back(i); |
| 662 } | 666 } |
| 663 } | 667 } |
| 664 | 668 |
| 665 if (tutorial_view) { | 669 if (tutorial_view) { |
| 670 // Be sure not to track the tutorial display on View refresh. | |
| 671 if (tutorial_shown == FALSE) | |
| 672 ProfileMetrics::LogProfileMirrorEnrollment(ProfileMetrics::PROMO_DISPLAY); | |
|
guohui
2014/04/16 15:47:45
we have two different tutorials at the moment, one
Mike Lerman
2014/04/24 15:14:16
Done.
| |
| 666 layout->StartRow(1, 0); | 673 layout->StartRow(1, 0); |
| 667 layout->AddView(tutorial_view); | 674 layout->AddView(tutorial_view); |
| 668 } | 675 } |
| 669 | 676 |
| 670 if (!current_profile_view) { | 677 if (!current_profile_view) { |
| 671 // Guest windows don't have an active profile. | 678 // Guest windows don't have an active profile. |
| 672 current_profile_view = CreateGuestProfileView(); | 679 current_profile_view = CreateGuestProfileView(); |
| 673 option_buttons_view = CreateOptionsView(false); | 680 option_buttons_view = CreateOptionsView(false); |
| 674 } | 681 } |
| 675 | 682 |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 g_browser_process->local_state()); | 1191 g_browser_process->local_state()); |
| 1185 about_flags::SetExperimentEnabled( | 1192 about_flags::SetExperimentEnabled( |
| 1186 &flags_storage, | 1193 &flags_storage, |
| 1187 kNewProfileManagementExperimentInternalName, | 1194 kNewProfileManagementExperimentInternalName, |
| 1188 true); | 1195 true); |
| 1189 | 1196 |
| 1190 CommandLine::ForCurrentProcess()->AppendSwitch( | 1197 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1191 switches::kNewProfileManagement); | 1198 switches::kNewProfileManagement); |
| 1192 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 1199 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 1193 } | 1200 } |
| OLD | NEW |