Chromium Code Reviews| 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" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 // has no parent (like in tests) because that will also crash. | 510 // has no parent (like in tests) because that will also crash. |
| 511 if (sender->parent()) | 511 if (sender->parent()) |
| 512 sender->SetEnabled(false); | 512 sender->SetEnabled(false); |
| 513 | 513 |
| 514 if (sender == guest_button_) { | 514 if (sender == guest_button_) { |
| 515 profiles::SwitchToGuestProfile(browser_->host_desktop_type(), | 515 profiles::SwitchToGuestProfile(browser_->host_desktop_type(), |
| 516 profiles::ProfileSwitchingDoneCallback()); | 516 profiles::ProfileSwitchingDoneCallback()); |
| 517 } else if (sender == end_guest_button_) { | 517 } else if (sender == end_guest_button_) { |
| 518 profiles::CloseGuestProfileWindows(); | 518 profiles::CloseGuestProfileWindows(); |
| 519 } else if (sender == users_button_) { | 519 } else if (sender == users_button_) { |
| 520 // Only non-guest users appear in the User Manager. | 520 if (end_guest_button_) |
|
Alexei Svitkine (slow)
2014/03/19 16:37:01
Can you preserve some comment explaining this if s
Alexei Svitkine (slow)
2014/03/19 16:37:01
Can you avoid having the logic to call the differe
noms (inactive)
2014/03/19 17:10:38
Done.
noms (inactive)
2014/03/19 17:10:38
Done.
| |
| 521 base::FilePath profile_path; | 521 chrome::ShowUserManager(base::FilePath()); |
| 522 if (!end_guest_button_) { | 522 else |
| 523 size_t active_index = avatar_menu_->GetActiveProfileIndex(); | 523 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
| 524 profile_path = avatar_menu_->GetItemAt(active_index).profile_path; | |
| 525 } | |
| 526 chrome::ShowUserManager(profile_path); | |
| 527 } else if (sender == add_user_button_) { | 524 } else if (sender == add_user_button_) { |
| 528 profiles::CreateAndSwitchToNewProfile( | 525 profiles::CreateAndSwitchToNewProfile( |
| 529 browser_->host_desktop_type(), | 526 browser_->host_desktop_type(), |
| 530 profiles::ProfileSwitchingDoneCallback(), | 527 profiles::ProfileSwitchingDoneCallback(), |
| 531 ProfileMetrics::ADD_NEW_USER_ICON); | 528 ProfileMetrics::ADD_NEW_USER_ICON); |
| 532 } else if (sender == add_account_button_) { | 529 } else if (sender == add_account_button_) { |
| 533 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); | 530 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); |
| 534 } else if (sender == current_profile_photo_->change_photo_button()) { | 531 } else if (sender == current_profile_photo_->change_photo_button()) { |
| 535 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); | 532 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
| 536 } else if (sender == tutorial_ok_button_) { | 533 } else if (sender == tutorial_ok_button_) { |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 if (!is_primary_account) { | 939 if (!is_primary_account) { |
| 943 email_button->set_menu_marker(menu_marker); | 940 email_button->set_menu_marker(menu_marker); |
| 944 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 941 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 945 } | 942 } |
| 946 layout->StartRow(1, 0); | 943 layout->StartRow(1, 0); |
| 947 layout->AddView(email_button); | 944 layout->AddView(email_button); |
| 948 | 945 |
| 949 // Save the original email address, as the button text could be elided. | 946 // Save the original email address, as the button text could be elided. |
| 950 current_profile_accounts_map_[email_button] = account; | 947 current_profile_accounts_map_[email_button] = account; |
| 951 } | 948 } |
| OLD | NEW |