OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/session_controller_client.h" | 5 #include "chrome/browser/ui/ash/session_controller_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/public/cpp/session_types.h" | 10 #include "ash/public/cpp/session_types.h" |
| 11 #include "ash/public/interfaces/constants.mojom.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 15 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/ash/ash_util.h" | |
18 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" | 18 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/grit/theme_resources.h" | 20 #include "chrome/grit/theme_resources.h" |
21 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
22 #include "chromeos/dbus/session_manager_client.h" | 22 #include "chromeos/dbus/session_manager_client.h" |
23 #include "components/prefs/pref_service.h" | 23 #include "components/prefs/pref_service.h" |
24 #include "components/session_manager/core/session_manager.h" | 24 #include "components/session_manager/core/session_manager.h" |
25 #include "content/public/common/service_manager_connection.h" | 25 #include "content/public/common/service_manager_connection.h" |
26 #include "content/public/common/service_names.mojom.h" | 26 #include "content/public/common/service_names.mojom.h" |
27 #include "services/service_manager/public/cpp/connector.h" | 27 #include "services/service_manager/public/cpp/connector.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 g_instance->session_controller_.FlushForTesting(); | 239 g_instance->session_controller_.FlushForTesting(); |
240 } | 240 } |
241 | 241 |
242 void SessionControllerClient::OnSessionStateChanged() { | 242 void SessionControllerClient::OnSessionStateChanged() { |
243 SendSessionInfoIfChanged(); | 243 SendSessionInfoIfChanged(); |
244 } | 244 } |
245 | 245 |
246 void SessionControllerClient::ConnectToSessionControllerAndSetClient() { | 246 void SessionControllerClient::ConnectToSessionControllerAndSetClient() { |
247 content::ServiceManagerConnection::GetForProcess() | 247 content::ServiceManagerConnection::GetForProcess() |
248 ->GetConnector() | 248 ->GetConnector() |
249 ->BindInterface(ash_util::GetAshServiceName(), &session_controller_); | 249 ->BindInterface(ash::mojom::kServiceName, &session_controller_); |
250 | 250 |
251 // Set as |session_controller_|'s client. | 251 // Set as |session_controller_|'s client. |
252 session_controller_->SetClient(binding_.CreateInterfacePtrAndBind()); | 252 session_controller_->SetClient(binding_.CreateInterfacePtrAndBind()); |
253 } | 253 } |
254 | 254 |
255 void SessionControllerClient::SendSessionInfoIfChanged() { | 255 void SessionControllerClient::SendSessionInfoIfChanged() { |
256 SessionManager* const session_manager = SessionManager::Get(); | 256 SessionManager* const session_manager = SessionManager::Get(); |
257 | 257 |
258 ash::mojom::SessionInfoPtr info = ash::mojom::SessionInfo::New(); | 258 ash::mojom::SessionInfoPtr info = ash::mojom::SessionInfo::New(); |
259 info->can_lock_screen = CanLockScreen(); | 259 info->can_lock_screen = CanLockScreen(); |
(...skipping 26 matching lines...) Expand all Loading... |
286 const UserList logged_in_users = user_manager->GetLoggedInUsers(); | 286 const UserList logged_in_users = user_manager->GetLoggedInUsers(); |
287 std::vector<uint32_t> user_session_ids; | 287 std::vector<uint32_t> user_session_ids; |
288 for (auto* user : user_manager->GetLRULoggedInUsers()) { | 288 for (auto* user : user_manager->GetLRULoggedInUsers()) { |
289 const uint32_t user_session_id = GetSessionId(*user); | 289 const uint32_t user_session_id = GetSessionId(*user); |
290 DCHECK_NE(0u, user_session_id); | 290 DCHECK_NE(0u, user_session_id); |
291 user_session_ids.push_back(user_session_id); | 291 user_session_ids.push_back(user_session_id); |
292 } | 292 } |
293 | 293 |
294 session_controller_->SetUserSessionOrder(user_session_ids); | 294 session_controller_->SetUserSessionOrder(user_session_ids); |
295 } | 295 } |
OLD | NEW |