OLD | NEW |
---|---|
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 Loading... | |
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. | |
527 bool tutorial_shown = browser_->profile()->GetPrefs()->GetBoolean( | |
Alexei Svitkine (slow)
2014/03/14 21:04:40
Same comment about caching profile prefs pointer.
noms (inactive)
2014/03/17 21:52:23
Done.
| |
528 prefs::kProfileUserManagerTutorialShown); | |
529 if (!tutorial_shown) { | |
530 browser_->profile()->GetPrefs()->SetBoolean( | |
531 prefs::kProfileUserManagerTutorialShown, true); | |
532 } | |
533 UserManagerView::Show(profile_path, !tutorial_shown); | |
527 } else if (sender == add_user_button_) { | 534 } else if (sender == add_user_button_) { |
528 profiles::CreateAndSwitchToNewProfile( | 535 profiles::CreateAndSwitchToNewProfile( |
529 browser_->host_desktop_type(), | 536 browser_->host_desktop_type(), |
530 profiles::ProfileSwitchingDoneCallback(), | 537 profiles::ProfileSwitchingDoneCallback(), |
531 ProfileMetrics::ADD_NEW_USER_ICON); | 538 ProfileMetrics::ADD_NEW_USER_ICON); |
532 } else if (sender == add_account_button_) { | 539 } else if (sender == add_account_button_) { |
533 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); | 540 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); |
534 } else if (sender == current_profile_photo_->change_photo_button()) { | 541 } else if (sender == current_profile_photo_->change_photo_button()) { |
535 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); | 542 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
536 } else if (sender == tutorial_ok_button_) { | 543 } else if (sender == tutorial_ok_button_) { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
942 if (!is_primary_account) { | 949 if (!is_primary_account) { |
943 email_button->set_menu_marker(menu_marker); | 950 email_button->set_menu_marker(menu_marker); |
944 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 951 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
945 } | 952 } |
946 layout->StartRow(1, 0); | 953 layout->StartRow(1, 0); |
947 layout->AddView(email_button); | 954 layout->AddView(email_button); |
948 | 955 |
949 // Save the original email address, as the button text could be elided. | 956 // Save the original email address, as the button text could be elided. |
950 current_profile_accounts_map_[email_button] = account; | 957 current_profile_accounts_map_[email_button] = account; |
951 } | 958 } |
OLD | NEW |