OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | |
Ilya Sherman
2015/04/07 21:31:18
nit: Please include histogram_macros instead
| |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/prefs/pref_member.h" | 15 #include "base/prefs/pref_member.h" |
15 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
16 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
19 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
20 #include "base/task_runner_util.h" | 21 #include "base/task_runner_util.h" |
21 #include "base/threading/worker_pool.h" | 22 #include "base/threading/worker_pool.h" |
22 #include "chrome/browser/about_flags.h" | 23 #include "chrome/browser/about_flags.h" |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 | 1456 |
1456 const user_manager::User* user = | 1457 const user_manager::User* user = |
1457 user_manager::UserManager::Get()->FindUser(user_id); | 1458 user_manager::UserManager::Get()->FindUser(user_id); |
1458 EasyUnlockService* easy_unlock_service = | 1459 EasyUnlockService* easy_unlock_service = |
1459 EasyUnlockService::GetForUser(*user); | 1460 EasyUnlockService::GetForUser(*user); |
1460 easy_unlock_service->CheckCryptohomeKeysAndMaybeHardlock(); | 1461 easy_unlock_service->CheckCryptohomeKeysAndMaybeHardlock(); |
1461 } | 1462 } |
1462 | 1463 |
1463 void UserSessionManager::ActiveUserChanged( | 1464 void UserSessionManager::ActiveUserChanged( |
1464 const user_manager::User* active_user) { | 1465 const user_manager::User* active_user) { |
1466 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) | |
1467 SendUserPodsMetrics(); | |
1468 | |
1465 Profile* profile = ProfileHelper::Get()->GetProfileByUser(active_user); | 1469 Profile* profile = ProfileHelper::Get()->GetProfileByUser(active_user); |
1466 // If profile has not yet been initialized, delay initialization of IME. | 1470 // If profile has not yet been initialized, delay initialization of IME. |
1467 if (!profile) | 1471 if (!profile) |
1468 return; | 1472 return; |
1469 | 1473 |
1470 input_method::InputMethodManager* manager = | 1474 input_method::InputMethodManager* manager = |
1471 input_method::InputMethodManager::Get(); | 1475 input_method::InputMethodManager::Get(); |
1472 manager->SetState( | 1476 manager->SetState( |
1473 GetDefaultIMEState(ProfileHelper::Get()->GetProfileByUser(active_user))); | 1477 GetDefaultIMEState(ProfileHelper::Get()->GetProfileByUser(active_user))); |
1474 } | 1478 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1579 void UserSessionManager::RemoveProfileForTesting(Profile* profile) { | 1583 void UserSessionManager::RemoveProfileForTesting(Profile* profile) { |
1580 default_ime_states_.erase(profile); | 1584 default_ime_states_.erase(profile); |
1581 } | 1585 } |
1582 | 1586 |
1583 void UserSessionManager::InjectStubUserContext( | 1587 void UserSessionManager::InjectStubUserContext( |
1584 const UserContext& user_context) { | 1588 const UserContext& user_context) { |
1585 injected_user_context_.reset(new UserContext(user_context)); | 1589 injected_user_context_.reset(new UserContext(user_context)); |
1586 authenticator_ = NULL; | 1590 authenticator_ = NULL; |
1587 } | 1591 } |
1588 | 1592 |
1593 void UserSessionManager::SendUserPodsMetrics() { | |
1594 bool show_users_on_signin; | |
1595 CrosSettings::Get()->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | |
1596 &show_users_on_signin); | |
1597 bool is_enterprise_managed = g_browser_process->platform_part() | |
1598 ->browser_policy_connector_chromeos() | |
1599 ->IsEnterpriseManaged(); | |
1600 UserPodsDisplay display; | |
1601 if (show_users_on_signin) { | |
1602 if (is_enterprise_managed) | |
1603 display = USER_PODS_DISPLAY_ENABLED_MANAGED; | |
1604 else | |
1605 display = USER_PODS_DISPLAY_ENABLED_REGULAR; | |
1606 } else { | |
1607 if (is_enterprise_managed) | |
1608 display = USER_PODS_DISPLAY_DISABLED_MANAGED; | |
1609 else | |
1610 display = USER_PODS_DISPLAY_DISABLED_REGULAR; | |
1611 } | |
1612 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, | |
1613 NUM_USER_PODS_DISPLAY); | |
1614 } | |
1615 | |
1589 } // namespace chromeos | 1616 } // namespace chromeos |
OLD | NEW |