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

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

Issue 199533004: [Mac, Win] Show a user manager tutorial once per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: much refactor. such change. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/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/profiles/profile_info_util.h" 10 #include "chrome/browser/profiles/profile_info_util.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/profiles/profile_window.h" 12 #include "chrome/browser/profiles/profile_window.h"
13 #include "chrome/browser/profiles/profiles_state.h" 13 #include "chrome/browser/profiles/profiles_state.h"
14 #include "chrome/browser/signin/mutable_profile_oauth2_token_service.h" 14 #include "chrome/browser/signin/mutable_profile_oauth2_token_service.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager.h" 17 #include "chrome/browser/signin/signin_manager.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/signin/signin_promo.h" 19 #include "chrome/browser/signin/signin_promo.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_dialogs.h"
22 #include "chrome/browser/ui/singleton_tabs.h" 21 #include "chrome/browser/ui/singleton_tabs.h"
23 #include "chrome/browser/ui/views/user_manager_view.h" 22 #include "chrome/browser/ui/views/user_manager_view.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
26 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
27 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
29 #include "third_party/skia/include/core/SkColor.h" 28 #include "third_party/skia/include/core/SkColor.h"
30 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 profiles::ProfileSwitchingDoneCallback()); 515 profiles::ProfileSwitchingDoneCallback());
517 } else if (sender == end_guest_button_) { 516 } else if (sender == end_guest_button_) {
518 profiles::CloseGuestProfileWindows(); 517 profiles::CloseGuestProfileWindows();
519 } else if (sender == users_button_) { 518 } else if (sender == users_button_) {
520 // Only non-guest users appear in the User Manager. 519 // Only non-guest users appear in the User Manager.
521 base::FilePath profile_path; 520 base::FilePath profile_path;
522 if (!end_guest_button_) { 521 if (!end_guest_button_) {
523 size_t active_index = avatar_menu_->GetActiveProfileIndex(); 522 size_t active_index = avatar_menu_->GetActiveProfileIndex();
524 profile_path = avatar_menu_->GetItemAt(active_index).profile_path; 523 profile_path = avatar_menu_->GetItemAt(active_index).profile_path;
525 } 524 }
526 chrome::ShowUserManager(profile_path); 525
526 // Show the tutorial if it hasn't been shown before. This is the same
527 // logic as in profile_chooser_controller.mm.
528 PrefService* pref_service = browser_->profile()->GetPrefs();
529 bool tutorial_shown = pref_service->GetBoolean(
530 prefs::kProfileUserManagerTutorialShown);
531 if (!tutorial_shown)
532 pref_service->SetBoolean(prefs::kProfileUserManagerTutorialShown, true);
533 UserManagerView::Show(
534 profile_path,
535 tutorial_shown ? profiles::USER_MANAGER_NO_TUTORIAL :
536 profiles::USER_MANAGER_TUTORIAL_OVERVIEW);
Alexei Svitkine (slow) 2014/03/18 15:50:33 I think it would be better to keep the entry point
noms (inactive) 2014/03/18 17:39:09 The problem with that is that ShowUserManager() ca
Alexei Svitkine (slow) 2014/03/18 17:45:40 I see - okay, sgtm.
noms (inactive) 2014/03/19 15:58:20 Done.
527 } else if (sender == add_user_button_) { 537 } else if (sender == add_user_button_) {
528 profiles::CreateAndSwitchToNewProfile( 538 profiles::CreateAndSwitchToNewProfile(
529 browser_->host_desktop_type(), 539 browser_->host_desktop_type(),
530 profiles::ProfileSwitchingDoneCallback(), 540 profiles::ProfileSwitchingDoneCallback(),
531 ProfileMetrics::ADD_NEW_USER_ICON); 541 ProfileMetrics::ADD_NEW_USER_ICON);
532 } else if (sender == add_account_button_) { 542 } else if (sender == add_account_button_) {
533 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); 543 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get());
534 } else if (sender == current_profile_photo_->change_photo_button()) { 544 } else if (sender == current_profile_photo_->change_photo_button()) {
535 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); 545 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex());
536 } else if (sender == tutorial_ok_button_) { 546 } else if (sender == tutorial_ok_button_) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 if (!is_primary_account) { 952 if (!is_primary_account) {
943 email_button->set_menu_marker(menu_marker); 953 email_button->set_menu_marker(menu_marker);
944 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 954 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
945 } 955 }
946 layout->StartRow(1, 0); 956 layout->StartRow(1, 0);
947 layout->AddView(email_button); 957 layout->AddView(email_button);
948 958
949 // Save the original email address, as the button text could be elided. 959 // Save the original email address, as the button text could be elided.
950 current_profile_accounts_map_[email_button] = account; 960 current_profile_accounts_map_[email_button] = account;
951 } 961 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698