| 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" |
| 11 #include "chrome/browser/ui/host_desktop.h" | 11 #include "chrome/browser/ui/host_desktop.h" |
| 12 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 12 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "ui/base/accelerators/accelerator.h" | 15 #include "ui/base/accelerators/accelerator.h" |
| 16 #include "ui/base/models/simple_menu_model.h" | 16 #include "ui/base/models/simple_menu_model.h" |
| 17 | 17 |
| 18 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
| 19 #include "ash/session_state_delegate.h" | 19 #include "ash/session/session_state_delegate.h" |
| 20 #include "ash/session/user_info.h" |
| 20 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 21 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 22 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 22 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 23 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 SystemMenuModelBuilder::SystemMenuModelBuilder( | 28 SystemMenuModelBuilder::SystemMenuModelBuilder( |
| 28 ui::AcceleratorProvider* provider, | 29 ui::AcceleratorProvider* provider, |
| 29 Browser* browser) | 30 Browser* browser) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 chrome::MultiUserWindowManager::GetInstance(); | 145 chrome::MultiUserWindowManager::GetInstance(); |
| 145 const std::string user_id = | 146 const std::string user_id = |
| 146 multi_user_util::GetUserIDFromProfile(browser()->profile()); | 147 multi_user_util::GetUserIDFromProfile(browser()->profile()); |
| 147 aura::Window* window = browser()->window()->GetNativeWindow(); | 148 aura::Window* window = browser()->window()->GetNativeWindow(); |
| 148 if (user_id.empty() || !window || manager->GetWindowOwner(window).empty()) | 149 if (user_id.empty() || !window || manager->GetWindowOwner(window).empty()) |
| 149 return; | 150 return; |
| 150 | 151 |
| 151 model->AddSeparator(ui::NORMAL_SEPARATOR); | 152 model->AddSeparator(ui::NORMAL_SEPARATOR); |
| 152 DCHECK(logged_in_users <= 3); | 153 DCHECK(logged_in_users <= 3); |
| 153 for (int user_index = 1; user_index < logged_in_users; ++user_index) { | 154 for (int user_index = 1; user_index < logged_in_users; ++user_index) { |
| 155 const ash::UserInfo* user_info = delegate->GetUserInfo(user_index); |
| 154 model->AddItem( | 156 model->AddItem( |
| 155 user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 : | 157 user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 |
| 156 IDC_VISIT_DESKTOP_OF_LRU_USER_3, | 158 : IDC_VISIT_DESKTOP_OF_LRU_USER_3, |
| 157 l10n_util::GetStringFUTF16( | 159 l10n_util::GetStringFUTF16(IDS_VISIT_DESKTOP_OF_LRU_USER, |
| 158 IDS_VISIT_DESKTOP_OF_LRU_USER, | 160 user_info->GetDisplayName(), |
| 159 delegate->GetUserDisplayName(user_index), | 161 base::ASCIIToUTF16(user_info->GetEmail()))); |
| 160 base::ASCIIToUTF16(delegate->GetUserEmail(user_index)))); | |
| 161 } | 162 } |
| 162 #endif | 163 #endif |
| 163 } | 164 } |
| OLD | NEW |