| 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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 if (RestartToApplyPerSessionFlagsIfNeed(profile, false)) | 1755 if (RestartToApplyPerSessionFlagsIfNeed(profile, false)) |
| 1755 return; | 1756 return; |
| 1756 | 1757 |
| 1757 if (login_host) { | 1758 if (login_host) { |
| 1758 login_host->SetStatusAreaVisible(true); | 1759 login_host->SetStatusAreaVisible(true); |
| 1759 login_host->BeforeSessionStart(); | 1760 login_host->BeforeSessionStart(); |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1762 BootTimesRecorder::Get()->AddLoginTimeMarker("BrowserLaunched", false); | 1763 BootTimesRecorder::Get()->AddLoginTimeMarker("BrowserLaunched", false); |
| 1763 | 1764 |
| 1764 // Mark user session as started before creating browser window. Otherwise, | |
| 1765 // ash would not activate the created browser window because it thinks | |
| 1766 // user session is blocked. | |
| 1767 session_manager::SessionManager::Get()->SessionStarted(); | |
| 1768 | |
| 1769 VLOG(1) << "Launching browser..."; | 1765 VLOG(1) << "Launching browser..."; |
| 1770 TRACE_EVENT0("login", "LaunchBrowser"); | 1766 TRACE_EVENT0("login", "LaunchBrowser"); |
| 1771 | 1767 |
| 1772 if (should_launch_browser_) { | 1768 if (should_launch_browser_) { |
| 1773 StartupBrowserCreator browser_creator; | 1769 StartupBrowserCreator browser_creator; |
| 1774 chrome::startup::IsFirstRun first_run = | 1770 chrome::startup::IsFirstRun first_run = |
| 1775 ::first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN | 1771 ::first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN |
| 1776 : chrome::startup::IS_NOT_FIRST_RUN; | 1772 : chrome::startup::IS_NOT_FIRST_RUN; |
| 1777 | 1773 |
| 1778 browser_creator.LaunchBrowser( | 1774 browser_creator.LaunchBrowser( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 ShouldShowFingerprintNotification(profile) && | 1807 ShouldShowFingerprintNotification(profile) && |
| 1812 fingerprint_unlock_notification_handler_.find(profile) == | 1808 fingerprint_unlock_notification_handler_.find(profile) == |
| 1813 fingerprint_unlock_notification_handler_.end()) { | 1809 fingerprint_unlock_notification_handler_.end()) { |
| 1814 auto* fingerprint_feature_notification_controller = | 1810 auto* fingerprint_feature_notification_controller = |
| 1815 quick_unlock::QuickUnlockNotificationController::CreateForFingerprint( | 1811 quick_unlock::QuickUnlockNotificationController::CreateForFingerprint( |
| 1816 profile); | 1812 profile); |
| 1817 fingerprint_unlock_notification_handler_.insert( | 1813 fingerprint_unlock_notification_handler_.insert( |
| 1818 std::make_pair(profile, fingerprint_feature_notification_controller)); | 1814 std::make_pair(profile, fingerprint_feature_notification_controller)); |
| 1819 } | 1815 } |
| 1820 | 1816 |
| 1817 base::OnceClosure login_host_finalized_callback = base::BindOnce( |
| 1818 [] { session_manager::SessionManager::Get()->SessionStarted(); }); |
| 1819 |
| 1821 // Mark login host for deletion after browser starts. This | 1820 // Mark login host for deletion after browser starts. This |
| 1822 // guarantees that the message loop will be referenced by the | 1821 // guarantees that the message loop will be referenced by the |
| 1823 // browser before it is dereferenced by the login host. | 1822 // browser before it is dereferenced by the login host. |
| 1824 if (login_host) | 1823 if (login_host) { |
| 1825 login_host->Finalize(); | 1824 login_host->Finalize(std::move(login_host_finalized_callback)); |
| 1825 } else { |
| 1826 base::ResetAndReturn(&login_host_finalized_callback).Run(); |
| 1827 } |
| 1828 |
| 1826 chromeos::BootTimesRecorder::Get()->LoginDone( | 1829 chromeos::BootTimesRecorder::Get()->LoginDone( |
| 1827 user_manager::UserManager::Get()->IsCurrentUserNew()); | 1830 user_manager::UserManager::Get()->IsCurrentUserNew()); |
| 1828 | 1831 |
| 1829 // Check to see if this profile should show EndOfLife Notification and show | 1832 // Check to see if this profile should show EndOfLife Notification and show |
| 1830 // the message accordingly. | 1833 // the message accordingly. |
| 1831 if (ShouldShowEolNotification(profile)) | 1834 if (ShouldShowEolNotification(profile)) |
| 1832 CheckEolStatus(profile); | 1835 CheckEolStatus(profile); |
| 1833 | 1836 |
| 1834 // Show the one-time notification and update the relevant pref about the | 1837 // Show the one-time notification and update the relevant pref about the |
| 1835 // completion of the file system migration necessary for ARC, when needed. | 1838 // completion of the file system migration necessary for ARC, when needed. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 ->browser_policy_connector_chromeos() | 1960 ->browser_policy_connector_chromeos() |
| 1958 ->IsEnterpriseManaged()) { | 1961 ->IsEnterpriseManaged()) { |
| 1959 return false; | 1962 return false; |
| 1960 } | 1963 } |
| 1961 | 1964 |
| 1962 // Do not show end of life notification if this is a guest session | 1965 // Do not show end of life notification if this is a guest session |
| 1963 return !profile->IsGuestSession(); | 1966 return !profile->IsGuestSession(); |
| 1964 } | 1967 } |
| 1965 | 1968 |
| 1966 } // namespace chromeos | 1969 } // namespace chromeos |
| OLD | NEW |