| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // Only non-guest users appear in the User Manager. | 529 // Only non-guest users appear in the User Manager. |
| 530 base::FilePath profile_path; | 530 base::FilePath profile_path; |
| 531 if (!end_guest_button_) { | 531 if (!end_guest_button_) { |
| 532 size_t active_index = avatar_menu_->GetActiveProfileIndex(); | 532 size_t active_index = avatar_menu_->GetActiveProfileIndex(); |
| 533 profile_path = avatar_menu_->GetItemAt(active_index).profile_path; | 533 profile_path = avatar_menu_->GetItemAt(active_index).profile_path; |
| 534 } | 534 } |
| 535 chrome::ShowUserManager(profile_path); | 535 chrome::ShowUserManager(profile_path); |
| 536 } else if (sender == add_user_button_) { | 536 } else if (sender == add_user_button_) { |
| 537 profiles::CreateAndSwitchToNewProfile( | 537 profiles::CreateAndSwitchToNewProfile( |
| 538 browser_->host_desktop_type(), | 538 browser_->host_desktop_type(), |
| 539 profiles::ProfileSwitchingDoneCallback()); | 539 profiles::ProfileSwitchingDoneCallback(), |
| 540 ProfileMetrics::ADD_NEW_USER_ICON); |
| 540 } else if (sender == add_account_button_) { | 541 } else if (sender == add_account_button_) { |
| 541 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); | 542 ShowView(GAIA_ADD_ACCOUNT_VIEW, avatar_menu_.get()); |
| 542 } else if (sender == current_profile_photo_->change_photo_button()) { | 543 } else if (sender == current_profile_photo_->change_photo_button()) { |
| 543 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); | 544 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
| 544 } else { | 545 } else { |
| 545 // One of the "other profiles" buttons was pressed. | 546 // One of the "other profiles" buttons was pressed. |
| 546 ButtonIndexes::const_iterator match = | 547 ButtonIndexes::const_iterator match = |
| 547 open_other_profile_indexes_map_.find(sender); | 548 open_other_profile_indexes_map_.find(sender); |
| 548 DCHECK(match != open_other_profile_indexes_map_.end()); | 549 DCHECK(match != open_other_profile_indexes_map_.end()); |
| 549 avatar_menu_->SwitchToProfile( | 550 avatar_menu_->SwitchToProfile( |
| 550 match->second, | 551 match->second, |
| 551 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW); | 552 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, |
| 553 ProfileMetrics::SWITCH_PROFILE_ICON); |
| 552 } | 554 } |
| 553 } | 555 } |
| 554 | 556 |
| 555 void ProfileChooserView::OnMenuButtonClicked(views::View* source, | 557 void ProfileChooserView::OnMenuButtonClicked(views::View* source, |
| 556 const gfx::Point& point) { | 558 const gfx::Point& point) { |
| 557 AccountButtonIndexes::const_iterator match = | 559 AccountButtonIndexes::const_iterator match = |
| 558 current_profile_accounts_map_.find(source); | 560 current_profile_accounts_map_.find(source); |
| 559 DCHECK(match != current_profile_accounts_map_.end()); | 561 DCHECK(match != current_profile_accounts_map_.end()); |
| 560 | 562 |
| 561 MutableProfileOAuth2TokenService* oauth2_token_service = | 563 MutableProfileOAuth2TokenService* oauth2_token_service = |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 email_button->set_menu_marker( | 838 email_button->set_menu_marker( |
| 837 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia()); | 839 rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia()); |
| 838 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 840 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 839 } | 841 } |
| 840 layout->StartRow(1, 0); | 842 layout->StartRow(1, 0); |
| 841 layout->AddView(email_button); | 843 layout->AddView(email_button); |
| 842 | 844 |
| 843 // Save the original email address, as the button text could be elided. | 845 // Save the original email address, as the button text could be elided. |
| 844 current_profile_accounts_map_[email_button] = account; | 846 current_profile_accounts_map_[email_button] = account; |
| 845 } | 847 } |
| OLD | NEW |