Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 2531543003: Resolve initialize/destory order between ArcService and ArcSessionManager. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 #include "base/task_runner_util.h" 24 #include "base/task_runner_util.h"
25 #include "base/threading/thread_task_runner_handle.h" 25 #include "base/threading/thread_task_runner_handle.h"
26 #include "base/threading/worker_pool.h" 26 #include "base/threading/worker_pool.h"
27 #include "chrome/browser/about_flags.h" 27 #include "chrome/browser/about_flags.h"
28 #include "chrome/browser/app_mode/app_mode_utils.h" 28 #include "chrome/browser/app_mode/app_mode_utils.h"
29 #include "chrome/browser/browser_process.h" 29 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/browser_process_platform_part_chromeos.h" 30 #include "chrome/browser/browser_process_platform_part_chromeos.h"
31 #include "chrome/browser/browser_shutdown.h" 31 #include "chrome/browser/browser_shutdown.h"
32 #include "chrome/browser/chrome_notification_types.h" 32 #include "chrome/browser/chrome_notification_types.h"
33 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 33 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
34 #include "chrome/browser/chromeos/arc/arc_session_manager.h" 34 #include "chrome/browser/chromeos/arc/arc_service_launcher.h"
35 #include "chrome/browser/chromeos/base/locale_util.h" 35 #include "chrome/browser/chromeos/base/locale_util.h"
36 #include "chrome/browser/chromeos/boot_times_recorder.h" 36 #include "chrome/browser/chromeos/boot_times_recorder.h"
37 #include "chrome/browser/chromeos/first_run/first_run.h" 37 #include "chrome/browser/chromeos/first_run/first_run.h"
38 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" 38 #include "chrome/browser/chromeos/first_run/goodies_displayer.h"
39 #include "chrome/browser/chromeos/input_method/input_method_util.h" 39 #include "chrome/browser/chromeos/input_method/input_method_util.h"
40 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" 40 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h"
41 #include "chrome/browser/chromeos/login/chrome_restart_request.h" 41 #include "chrome/browser/chromeos/login/chrome_restart_request.h"
42 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" 42 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
43 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 43 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
44 #include "chrome/browser/chromeos/login/existing_user_controller.h" 44 #include "chrome/browser/chromeos/login/existing_user_controller.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "chromeos/cryptohome/cryptohome_parameters.h" 87 #include "chromeos/cryptohome/cryptohome_parameters.h"
88 #include "chromeos/cryptohome/cryptohome_util.h" 88 #include "chromeos/cryptohome/cryptohome_util.h"
89 #include "chromeos/dbus/cryptohome_client.h" 89 #include "chromeos/dbus/cryptohome_client.h"
90 #include "chromeos/dbus/dbus_thread_manager.h" 90 #include "chromeos/dbus/dbus_thread_manager.h"
91 #include "chromeos/dbus/session_manager_client.h" 91 #include "chromeos/dbus/session_manager_client.h"
92 #include "chromeos/login/auth/stub_authenticator.h" 92 #include "chromeos/login/auth/stub_authenticator.h"
93 #include "chromeos/network/portal_detector/network_portal_detector.h" 93 #include "chromeos/network/portal_detector/network_portal_detector.h"
94 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" 94 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h"
95 #include "chromeos/settings/cros_settings_names.h" 95 #include "chromeos/settings/cros_settings_names.h"
96 #include "components/arc/arc_bridge_service.h" 96 #include "components/arc/arc_bridge_service.h"
97 #include "components/arc/arc_service_manager.h"
98 #include "components/component_updater/component_updater_service.h" 97 #include "components/component_updater/component_updater_service.h"
99 #include "components/flags_ui/pref_service_flags_storage.h" 98 #include "components/flags_ui/pref_service_flags_storage.h"
100 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 99 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
101 #include "components/prefs/pref_member.h" 100 #include "components/prefs/pref_member.h"
102 #include "components/prefs/pref_registry_simple.h" 101 #include "components/prefs/pref_registry_simple.h"
103 #include "components/prefs/pref_service.h" 102 #include "components/prefs/pref_service.h"
104 #include "components/quirks/quirks_manager.h" 103 #include "components/quirks/quirks_manager.h"
105 #include "components/session_manager/core/session_manager.h" 104 #include "components/session_manager/core/session_manager.h"
106 #include "components/signin/core/account_id/account_id.h" 105 #include "components/signin/core/account_id/account_id.h"
107 #include "components/signin/core/browser/account_tracker_service.h" 106 #include "components/signin/core/browser/account_tracker_service.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 const user_manager::User* user = 1139 const user_manager::User* user =
1141 ProfileHelper::Get()->GetUserByProfile(profile); 1140 ProfileHelper::Get()->GetUserByProfile(profile);
1142 if (user_manager->GetPrimaryUser() == user) { 1141 if (user_manager->GetPrimaryUser() == user) {
1143 InitRlz(profile); 1142 InitRlz(profile);
1144 InitializeCerts(profile); 1143 InitializeCerts(profile);
1145 InitializeCRLSetFetcher(user); 1144 InitializeCRLSetFetcher(user);
1146 InitializeCertificateTransparencyComponents(user); 1145 InitializeCertificateTransparencyComponents(user);
1147 1146
1148 if (arc::ArcBridgeService::GetEnabled( 1147 if (arc::ArcBridgeService::GetEnabled(
1149 base::CommandLine::ForCurrentProcess())) { 1148 base::CommandLine::ForCurrentProcess())) {
1150 const AccountId& account_id = 1149 arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile);
1151 multi_user_util::GetAccountIdFromProfile(profile);
1152 std::unique_ptr<BooleanPrefMember> arc_enabled_pref =
1153 base::MakeUnique<BooleanPrefMember>();
1154 arc_enabled_pref->Init(prefs::kArcEnabled, profile->GetPrefs());
1155 DCHECK(arc::ArcServiceManager::Get());
1156 arc::ArcServiceManager::Get()->OnPrimaryUserProfilePrepared(
1157 account_id, std::move(arc_enabled_pref));
1158 arc::ArcSessionManager* arc_session_manager =
1159 arc::ArcSessionManager::Get();
1160 DCHECK(arc_session_manager);
1161 arc_session_manager->OnPrimaryUserProfilePrepared(profile);
1162 } 1150 }
1163 } 1151 }
1164 1152
1165 UpdateEasyUnlockKeys(user_context_); 1153 UpdateEasyUnlockKeys(user_context_);
1166 user_context_.ClearSecrets(); 1154 user_context_.ClearSecrets();
1167 if (TokenHandlesEnabled()) { 1155 if (TokenHandlesEnabled()) {
1168 CreateTokenUtilIfMissing(); 1156 CreateTokenUtilIfMissing();
1169 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) { 1157 if (token_handle_util_->ShouldObtainHandle(user->GetAccountId())) {
1170 if (!token_handle_fetcher_.get()) { 1158 if (!token_handle_fetcher_.get()) {
1171 token_handle_fetcher_.reset(new TokenHandleFetcher( 1159 token_handle_fetcher_.reset(new TokenHandleFetcher(
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 bool show_names_on_signin = true; 1822 bool show_names_on_signin = true;
1835 auto* cros_settings = CrosSettings::Get(); 1823 auto* cros_settings = CrosSettings::Get();
1836 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 1824 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
1837 &ephemeral_users_enabled); 1825 &ephemeral_users_enabled);
1838 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, 1826 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn,
1839 &show_names_on_signin); 1827 &show_names_on_signin);
1840 return show_names_on_signin && !ephemeral_users_enabled; 1828 return show_names_on_signin && !ephemeral_users_enabled;
1841 } 1829 }
1842 1830
1843 void UserSessionManager::Shutdown() { 1831 void UserSessionManager::Shutdown() {
1844 if (arc::ArcBridgeService::GetEnabled(
hidehiko 2016/11/25 06:44:30 Note: this is just redundant. UserSessionManager::
xiyuan 2016/11/28 22:33:28 Acknowledged.
1845 base::CommandLine::ForCurrentProcess())) {
1846 DCHECK(arc::ArcServiceManager::Get());
1847 arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get();
1848 if (arc_session_manager)
1849 arc_session_manager->Shutdown();
1850 }
1851 token_handle_fetcher_.reset(); 1832 token_handle_fetcher_.reset();
1852 token_handle_util_.reset(); 1833 token_handle_util_.reset();
1853 first_run::GoodiesDisplayer::Delete(); 1834 first_run::GoodiesDisplayer::Delete();
1854 } 1835 }
1855 1836
1856 void UserSessionManager::CreateTokenUtilIfMissing() { 1837 void UserSessionManager::CreateTokenUtilIfMissing() {
1857 if (!token_handle_util_.get()) 1838 if (!token_handle_util_.get())
1858 token_handle_util_.reset(new TokenHandleUtil()); 1839 token_handle_util_.reset(new TokenHandleUtil());
1859 } 1840 }
1860 1841
1861 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { 1842 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) {
1862 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1843 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1863 chromeos::switches::kDisableEolNotification)) { 1844 chromeos::switches::kDisableEolNotification)) {
1864 return false; 1845 return false;
1865 } 1846 }
1866 1847
1867 // Do not show end of life notification if this device is managed by 1848 // Do not show end of life notification if this device is managed by
1868 // enterprise user. 1849 // enterprise user.
1869 if (g_browser_process->platform_part() 1850 if (g_browser_process->platform_part()
1870 ->browser_policy_connector_chromeos() 1851 ->browser_policy_connector_chromeos()
1871 ->IsEnterpriseManaged()) { 1852 ->IsEnterpriseManaged()) {
1872 return false; 1853 return false;
1873 } 1854 }
1874 1855
1875 // Do not show end of life notification if this is a guest session 1856 // Do not show end of life notification if this is a guest session
1876 return !profile->IsGuestSession(); 1857 return !profile->IsGuestSession();
1877 } 1858 }
1878 1859
1879 } // namespace chromeos 1860 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698