| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/base_paths.h" | 13 #include "base/base_paths.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/location.h" | 17 #include "base/location.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 19 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 21 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 23 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 24 #include "base/task_scheduler/post_task.h" | 25 #include "base/task_scheduler/post_task.h" |
| (...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 if (RestartToApplyPerSessionFlagsIfNeed(profile, false)) | 1742 if (RestartToApplyPerSessionFlagsIfNeed(profile, false)) |
| 1742 return; | 1743 return; |
| 1743 | 1744 |
| 1744 if (login_host) { | 1745 if (login_host) { |
| 1745 login_host->SetStatusAreaVisible(true); | 1746 login_host->SetStatusAreaVisible(true); |
| 1746 login_host->BeforeSessionStart(); | 1747 login_host->BeforeSessionStart(); |
| 1747 } | 1748 } |
| 1748 | 1749 |
| 1749 BootTimesRecorder::Get()->AddLoginTimeMarker("BrowserLaunched", false); | 1750 BootTimesRecorder::Get()->AddLoginTimeMarker("BrowserLaunched", false); |
| 1750 | 1751 |
| 1751 // Mark user session as started before creating browser window. Otherwise, | |
| 1752 // ash would not activate the created browser window because it thinks | |
| 1753 // user session is blocked. | |
| 1754 session_manager::SessionManager::Get()->SessionStarted(); | |
| 1755 | |
| 1756 VLOG(1) << "Launching browser..."; | 1752 VLOG(1) << "Launching browser..."; |
| 1757 TRACE_EVENT0("login", "LaunchBrowser"); | 1753 TRACE_EVENT0("login", "LaunchBrowser"); |
| 1758 | 1754 |
| 1759 if (should_launch_browser_) { | 1755 if (should_launch_browser_) { |
| 1760 StartupBrowserCreator browser_creator; | 1756 StartupBrowserCreator browser_creator; |
| 1761 chrome::startup::IsFirstRun first_run = | 1757 chrome::startup::IsFirstRun first_run = |
| 1762 ::first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN | 1758 ::first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN |
| 1763 : chrome::startup::IS_NOT_FIRST_RUN; | 1759 : chrome::startup::IS_NOT_FIRST_RUN; |
| 1764 | 1760 |
| 1765 browser_creator.LaunchBrowser( | 1761 browser_creator.LaunchBrowser( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 ShouldShowFingerprintNotification(profile) && | 1794 ShouldShowFingerprintNotification(profile) && |
| 1799 fingerprint_unlock_notification_handler_.find(profile) == | 1795 fingerprint_unlock_notification_handler_.find(profile) == |
| 1800 fingerprint_unlock_notification_handler_.end()) { | 1796 fingerprint_unlock_notification_handler_.end()) { |
| 1801 auto* fingerprint_feature_notification_controller = | 1797 auto* fingerprint_feature_notification_controller = |
| 1802 quick_unlock::QuickUnlockNotificationController::CreateForFingerprint( | 1798 quick_unlock::QuickUnlockNotificationController::CreateForFingerprint( |
| 1803 profile); | 1799 profile); |
| 1804 fingerprint_unlock_notification_handler_.insert( | 1800 fingerprint_unlock_notification_handler_.insert( |
| 1805 std::make_pair(profile, fingerprint_feature_notification_controller)); | 1801 std::make_pair(profile, fingerprint_feature_notification_controller)); |
| 1806 } | 1802 } |
| 1807 | 1803 |
| 1804 base::OnceClosure login_host_finalized_callback = base::BindOnce( |
| 1805 [] { session_manager::SessionManager::Get()->SessionStarted(); }); |
| 1806 |
| 1808 // Mark login host for deletion after browser starts. This | 1807 // Mark login host for deletion after browser starts. This |
| 1809 // guarantees that the message loop will be referenced by the | 1808 // guarantees that the message loop will be referenced by the |
| 1810 // browser before it is dereferenced by the login host. | 1809 // browser before it is dereferenced by the login host. |
| 1811 if (login_host) | 1810 if (login_host) { |
| 1812 login_host->Finalize(); | 1811 login_host->Finalize(std::move(login_host_finalized_callback)); |
| 1812 } else { |
| 1813 base::ResetAndReturn(&login_host_finalized_callback).Run(); |
| 1814 } |
| 1815 |
| 1813 chromeos::BootTimesRecorder::Get()->LoginDone( | 1816 chromeos::BootTimesRecorder::Get()->LoginDone( |
| 1814 user_manager::UserManager::Get()->IsCurrentUserNew()); | 1817 user_manager::UserManager::Get()->IsCurrentUserNew()); |
| 1815 | 1818 |
| 1816 // Check to see if this profile should show EndOfLife Notification and show | 1819 // Check to see if this profile should show EndOfLife Notification and show |
| 1817 // the message accordingly. | 1820 // the message accordingly. |
| 1818 if (ShouldShowEolNotification(profile)) | 1821 if (ShouldShowEolNotification(profile)) |
| 1819 CheckEolStatus(profile); | 1822 CheckEolStatus(profile); |
| 1820 | 1823 |
| 1821 // Show the one-time notification and update the relevant pref about the | 1824 // Show the one-time notification and update the relevant pref about the |
| 1822 // completion of the file system migration necessary for ARC, when needed. | 1825 // completion of the file system migration necessary for ARC, when needed. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 ->browser_policy_connector_chromeos() | 1942 ->browser_policy_connector_chromeos() |
| 1940 ->IsEnterpriseManaged()) { | 1943 ->IsEnterpriseManaged()) { |
| 1941 return false; | 1944 return false; |
| 1942 } | 1945 } |
| 1943 | 1946 |
| 1944 // Do not show end of life notification if this is a guest session | 1947 // Do not show end of life notification if this is a guest session |
| 1945 return !profile->IsGuestSession(); | 1948 return !profile->IsGuestSession(); |
| 1946 } | 1949 } |
| 1947 | 1950 |
| 1948 } // namespace chromeos | 1951 } // namespace chromeos |
| OLD | NEW |