| 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/ash/multi_user/multi_user_context_menu.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" |
| 6 | 6 |
| 7 #include "ash/multi_profile_uma.h" | 7 #include "ash/multi_profile_uma.h" |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 19 #include "chrome/browser/ui/ash/multi_user/multi_user_warning_dialog.h" | 18 #include "chrome/browser/ui/ash/multi_user/multi_user_warning_dialog.h" |
| 20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 19 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 22 #include "components/user_manager/user.h" | 21 #include "components/user_manager/user.h" |
| 22 #include "components/user_manager/user_manager.h" |
| 23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/models/simple_menu_model.h" | 26 #include "ui/base/models/simple_menu_model.h" |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class MultiUserContextMenuChromeos : public ui::SimpleMenuModel, | 32 class MultiUserContextMenuChromeos : public ui::SimpleMenuModel, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ->session_state_delegate() | 123 ->session_state_delegate() |
| 124 ->GetUserInfo(IDC_VISIT_DESKTOP_OF_LRU_USER_2 == command_id ? 1 | 124 ->GetUserInfo(IDC_VISIT_DESKTOP_OF_LRU_USER_2 == command_id ? 1 |
| 125 : 2) | 125 : 2) |
| 126 ->GetUserID(); | 126 ->GetUserID(); |
| 127 base::Callback<void(bool)> on_accept = | 127 base::Callback<void(bool)> on_accept = |
| 128 base::Bind(&OnAcceptTeleportWarning, user_id, window); | 128 base::Bind(&OnAcceptTeleportWarning, user_id, window); |
| 129 | 129 |
| 130 // Don't show warning dialog if any logged in user in multi-profiles | 130 // Don't show warning dialog if any logged in user in multi-profiles |
| 131 // session dismissed it. | 131 // session dismissed it. |
| 132 const user_manager::UserList logged_in_users = | 132 const user_manager::UserList logged_in_users = |
| 133 chromeos::UserManager::Get()->GetLoggedInUsers(); | 133 user_manager::UserManager::Get()->GetLoggedInUsers(); |
| 134 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); | 134 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); |
| 135 it != logged_in_users.end(); | 135 it != logged_in_users.end(); |
| 136 ++it) { | 136 ++it) { |
| 137 if (multi_user_util::GetProfileFromUserID( | 137 if (multi_user_util::GetProfileFromUserID( |
| 138 multi_user_util::GetUserIDFromEmail((*it)->email()))->GetPrefs()-> | 138 multi_user_util::GetUserIDFromEmail((*it)->email()))->GetPrefs()-> |
| 139 GetBoolean(prefs::kMultiProfileWarningShowDismissed)) { | 139 GetBoolean(prefs::kMultiProfileWarningShowDismissed)) { |
| 140 bool active_user_show_option = | 140 bool active_user_show_option = |
| 141 ProfileManager::GetActiveUserProfile()-> | 141 ProfileManager::GetActiveUserProfile()-> |
| 142 GetPrefs()->GetBoolean(prefs::kMultiProfileWarningShowDismissed); | 142 GetPrefs()->GetBoolean(prefs::kMultiProfileWarningShowDismissed); |
| 143 on_accept.Run(active_user_show_option); | 143 on_accept.Run(active_user_show_option); |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 chromeos::ShowMultiprofilesWarningDialog(on_accept); | 147 chromeos::ShowMultiprofilesWarningDialog(on_accept); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 default: | 150 default: |
| 151 NOTREACHED(); | 151 NOTREACHED(); |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |