| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/frame/system_menu_model_builder.h" | 5 #include "chrome/browser/ui/views/frame/system_menu_model_builder.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ash::SessionStateDelegate* delegate = | 162 ash::SessionStateDelegate* delegate = |
| 163 ash::Shell::GetInstance()->session_state_delegate(); | 163 ash::Shell::GetInstance()->session_state_delegate(); |
| 164 int logged_in_users = delegate->NumberOfLoggedInUsers(); | 164 int logged_in_users = delegate->NumberOfLoggedInUsers(); |
| 165 if (logged_in_users <= 1) | 165 if (logged_in_users <= 1) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 // If this does not belong to a profile or there is no window, or the window | 168 // If this does not belong to a profile or there is no window, or the window |
| 169 // is not owned by anyone, we don't show the menu addition. | 169 // is not owned by anyone, we don't show the menu addition. |
| 170 chrome::MultiUserWindowManager* manager = | 170 chrome::MultiUserWindowManager* manager = |
| 171 chrome::MultiUserWindowManager::GetInstance(); | 171 chrome::MultiUserWindowManager::GetInstance(); |
| 172 const std::string user_id = | 172 const user_manager::UserID user_id = |
| 173 multi_user_util::GetUserIDFromProfile(browser()->profile()); | 173 multi_user_util::GetUserIDFromProfile(browser()->profile()); |
| 174 aura::Window* window = browser()->window()->GetNativeWindow(); | 174 aura::Window* window = browser()->window()->GetNativeWindow(); |
| 175 if (user_id.empty() || !window || manager->GetWindowOwner(window).empty()) | 175 if (user_id.empty() || !window || manager->GetWindowOwner(window).empty()) |
| 176 return; | 176 return; |
| 177 | 177 |
| 178 model->AddSeparator(ui::NORMAL_SEPARATOR); | 178 model->AddSeparator(ui::NORMAL_SEPARATOR); |
| 179 DCHECK(logged_in_users <= 3); | 179 DCHECK(logged_in_users <= 3); |
| 180 for (int user_index = 1; user_index < logged_in_users; ++user_index) { | 180 for (int user_index = 1; user_index < logged_in_users; ++user_index) { |
| 181 const user_manager::UserInfo* user_info = delegate->GetUserInfo(user_index); | 181 const user_manager::UserInfo* user_info = delegate->GetUserInfo(user_index); |
| 182 model->AddItem( | 182 model->AddItem( |
| 183 user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 | 183 user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 |
| 184 : IDC_VISIT_DESKTOP_OF_LRU_USER_3, | 184 : IDC_VISIT_DESKTOP_OF_LRU_USER_3, |
| 185 l10n_util::GetStringFUTF16(IDS_VISIT_DESKTOP_OF_LRU_USER, | 185 l10n_util::GetStringFUTF16(IDS_VISIT_DESKTOP_OF_LRU_USER, |
| 186 user_info->GetDisplayName(), | 186 user_info->GetDisplayName(), |
| 187 base::ASCIIToUTF16(user_info->GetEmail()))); | 187 base::ASCIIToUTF16(user_info->GetEmail()))); |
| 188 } | 188 } |
| 189 #endif | 189 #endif |
| 190 } | 190 } |
| OLD | NEW |