Chromium Code Reviews| 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> |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1203 ProfileHelper::Get()->FlushProfile(profile); | 1203 ProfileHelper::Get()->FlushProfile(profile); |
| 1204 | 1204 |
| 1205 // TODO(nkostylev): This pointer should probably never be NULL, but it looks | 1205 // TODO(nkostylev): This pointer should probably never be NULL, but it looks |
| 1206 // like OnProfileCreated() may be getting called before | 1206 // like OnProfileCreated() may be getting called before |
| 1207 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is | 1207 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is |
| 1208 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace | 1208 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace |
| 1209 // this 'if' statement with a CHECK(delegate_) once the underlying issue is | 1209 // this 'if' statement with a CHECK(delegate_) once the underlying issue is |
| 1210 // resolved. | 1210 // resolved. |
| 1211 if (delegate_) | 1211 if (delegate_) |
| 1212 delegate_->OnProfilePrepared(profile, browser_launched); | 1212 delegate_->OnProfilePrepared(profile, browser_launched); |
| 1213 | |
| 1214 // Check to see if this profile should show EndOfLife Notification and show | |
| 1215 // the message accordingly. | |
| 1216 if (!ShouldShowEolNotification(profile)) | |
| 1217 return; | |
| 1218 CheckEolStatus(profile); | |
| 1213 } | 1219 } |
| 1214 | 1220 |
| 1215 void UserSessionManager::ActivateWizard(const std::string& screen_name) { | 1221 void UserSessionManager::ActivateWizard(const std::string& screen_name) { |
| 1216 LoginDisplayHost* host = LoginDisplayHost::default_host(); | 1222 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 1217 CHECK(host); | 1223 CHECK(host); |
| 1218 host->StartWizard(screen_name); | 1224 host->StartWizard(screen_name); |
| 1219 } | 1225 } |
| 1220 | 1226 |
| 1221 void UserSessionManager::InitializeStartUrls() const { | 1227 void UserSessionManager::InitializeStartUrls() const { |
| 1222 // Child account status should be known by the time of this call. | 1228 // Child account status should be known by the time of this call. |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1662 scoped_refptr<input_method::InputMethodManager::State> state = | 1668 scoped_refptr<input_method::InputMethodManager::State> state = |
| 1663 default_ime_states_[profile]; | 1669 default_ime_states_[profile]; |
| 1664 if (!state.get()) { | 1670 if (!state.get()) { |
| 1665 // Profile can be NULL in tests. | 1671 // Profile can be NULL in tests. |
| 1666 state = input_method::InputMethodManager::Get()->CreateNewState(profile); | 1672 state = input_method::InputMethodManager::Get()->CreateNewState(profile); |
| 1667 default_ime_states_[profile] = state; | 1673 default_ime_states_[profile] = state; |
| 1668 } | 1674 } |
| 1669 return state; | 1675 return state; |
| 1670 } | 1676 } |
| 1671 | 1677 |
| 1678 void UserSessionManager::CheckEolStatus(Profile* profile) { | |
| 1679 std::map<Profile*, std::unique_ptr<EolNotification>, ProfileCompare>::iterator | |
| 1680 iter = eol_notification_handler_.find(profile); | |
| 1681 if (iter == eol_notification_handler_.end()) { | |
| 1682 iter = | |
| 1683 eol_notification_handler_ | |
| 1684 .insert(std::make_pair(profile, std::unique_ptr<EolNotification>( | |
|
oshima
2016/06/17 23:54:58
auto notification = base::WrapUnique(new EolNotifi
xiaoyinh(OOO Sep 11-29)
2016/06/18 01:08:12
Hi, I tried to modify like this, but it didn't com
oshima
2016/06/18 01:23:25
what was the error? Maybe std::move was missing?
| |
| 1685 new EolNotification(profile)))) | |
| 1686 .first; | |
| 1687 } | |
| 1688 iter->second->CheckEolStatus(); | |
| 1689 } | |
| 1690 | |
| 1672 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1691 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
| 1673 if (!easy_unlock_key_manager_) | 1692 if (!easy_unlock_key_manager_) |
| 1674 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1693 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
| 1675 | 1694 |
| 1676 return easy_unlock_key_manager_.get(); | 1695 return easy_unlock_key_manager_.get(); |
| 1677 } | 1696 } |
| 1678 | 1697 |
| 1679 void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, | 1698 void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, |
| 1680 LoginDisplayHost* login_host, | 1699 LoginDisplayHost* login_host, |
| 1681 bool locale_pref_checked) { | 1700 bool locale_pref_checked) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1844 token_handle_fetcher_.reset(); | 1863 token_handle_fetcher_.reset(); |
| 1845 token_handle_util_.reset(); | 1864 token_handle_util_.reset(); |
| 1846 first_run::GoodiesDisplayer::Delete(); | 1865 first_run::GoodiesDisplayer::Delete(); |
| 1847 } | 1866 } |
| 1848 | 1867 |
| 1849 void UserSessionManager::CreateTokenUtilIfMissing() { | 1868 void UserSessionManager::CreateTokenUtilIfMissing() { |
| 1850 if (!token_handle_util_.get()) | 1869 if (!token_handle_util_.get()) |
| 1851 token_handle_util_.reset(new TokenHandleUtil()); | 1870 token_handle_util_.reset(new TokenHandleUtil()); |
| 1852 } | 1871 } |
| 1853 | 1872 |
| 1873 bool UserSessionManager::ShouldShowEolNotification(Profile* profile) { | |
| 1874 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1875 chromeos::switches::kEnableEolNotification)) { | |
| 1876 return false; | |
| 1877 } | |
| 1878 | |
| 1879 // Do not show end of life notification if this device is managed by | |
| 1880 // enterprise user. | |
| 1881 if (g_browser_process->platform_part() | |
| 1882 ->browser_policy_connector_chromeos() | |
| 1883 ->IsEnterpriseManaged()) { | |
| 1884 return false; | |
| 1885 } | |
| 1886 | |
| 1887 // Do not show end of life notification if this is a guest session | |
| 1888 if (profile->IsGuestSession()) | |
| 1889 return false; | |
|
oshima
2016/06/17 23:54:58
just
return !profile->GeustSession();
xiaoyinh(OOO Sep 11-29)
2016/06/18 01:08:12
Done.
| |
| 1890 | |
| 1891 return true; | |
| 1892 } | |
| 1893 | |
| 1854 } // namespace chromeos | 1894 } // namespace chromeos |
| OLD | NEW |