| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profiles/avatar_menu.h" | 5 #include "chrome/browser/profiles/avatar_menu.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 UserManager::Show(item.profile_path, | 120 UserManager::Show(item.profile_path, |
| 121 profiles::USER_MANAGER_NO_TUTORIAL, | 121 profiles::USER_MANAGER_NO_TUTORIAL, |
| 122 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 122 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 #endif | 125 #endif |
| 126 | 126 |
| 127 base::FilePath path = | 127 base::FilePath path = |
| 128 profile_info_->GetPathOfProfileAtIndex(item.profile_index); | 128 profile_info_->GetPathOfProfileAtIndex(item.profile_index); |
| 129 | 129 |
| 130 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | 130 profiles::SwitchToProfile(path, always_create, |
| 131 if (browser_) | 131 ProfileManager::CreateCallback(), metric); |
| 132 desktop_type = browser_->host_desktop_type(); | |
| 133 | |
| 134 profiles::SwitchToProfile(path, desktop_type, always_create, | |
| 135 ProfileManager::CreateCallback(), | |
| 136 metric); | |
| 137 } | 132 } |
| 138 | 133 |
| 139 void AvatarMenu::AddNewProfile(ProfileMetrics::ProfileAdd type) { | 134 void AvatarMenu::AddNewProfile(ProfileMetrics::ProfileAdd type) { |
| 140 menu_actions_->AddNewProfile(type); | 135 menu_actions_->AddNewProfile(type); |
| 141 } | 136 } |
| 142 | 137 |
| 143 void AvatarMenu::EditProfile(size_t index) { | 138 void AvatarMenu::EditProfile(size_t index) { |
| 144 // Get the index in the profile cache from the menu index. | 139 // Get the index in the profile cache from the menu index. |
| 145 size_t profile_index = profile_list_->GetItemAt(index).profile_index; | 140 size_t profile_index = profile_list_->GetItemAt(index).profile_index; |
| 146 | 141 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (observer_) | 268 if (observer_) |
| 274 observer_->OnAvatarMenuChanged(this); | 269 observer_->OnAvatarMenuChanged(this); |
| 275 } | 270 } |
| 276 #endif | 271 #endif |
| 277 | 272 |
| 278 void AvatarMenu::Update() { | 273 void AvatarMenu::Update() { |
| 279 RebuildMenu(); | 274 RebuildMenu(); |
| 280 if (observer_) | 275 if (observer_) |
| 281 observer_->OnAvatarMenuChanged(this); | 276 observer_->OnAvatarMenuChanged(this); |
| 282 } | 277 } |
| OLD | NEW |