Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service_impl.cc |
| diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc |
| index 8b5c91422bc3020ad6c4d5bd64f7bb065c7ddcbf..5ec6e6386f58b3c175536f07d1ad71d09bd6695b 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service_impl.cc |
| +++ b/chrome/browser/ui/app_list/app_list_service_impl.cc |
| @@ -18,6 +18,7 @@ |
| #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| #include "chrome/browser/ui/app_list/profile_loader.h" |
| #include "chrome/browser/ui/app_list/profile_store.h" |
| +#include "chrome/browser/ui/user_manager.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| @@ -93,6 +94,13 @@ class ProfileStoreImpl : public ProfileStore { |
| void LoadProfileAsync(const base::FilePath& path, |
| base::Callback<void(Profile*)> callback) override { |
| + if (IsProfileLocked(path)) { |
| + UserManager::Show(base::FilePath(), |
|
tapted
2015/01/19 22:25:50
WDYT about just calling DismissAppList() before th
Mike Lerman
2015/01/21 21:54:13
We discussed offline - shall leave it as is. If th
|
| + profiles::USER_MANAGER_NO_TUTORIAL, |
| + profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER); |
| + return; |
| + } |
| + |
| profile_manager_->CreateProfileAsync( |
| path, |
| base::Bind(&ProfileStoreImpl::OnProfileCreated, |
| @@ -123,6 +131,8 @@ class ProfileStoreImpl : public ProfileStore { |
| } |
| Profile* GetProfileByPath(const base::FilePath& path) override { |
| + if (IsProfileLocked(path)) |
| + return nullptr; |
|
tapted
2015/01/19 22:25:51
I'm a little wary of this - I don't think it's the
Mike Lerman
2015/01/21 21:54:13
Done.
|
| return profile_manager_->GetProfileByPath(path); |
| } |
| @@ -138,6 +148,14 @@ class ProfileStoreImpl : public ProfileStore { |
| profile_info.ProfileIsSupervisedAtIndex(profile_index); |
| } |
| + bool IsProfileLocked(const base::FilePath& profile_path) { |
| + ProfileInfoCache& profile_info = |
| + g_browser_process->profile_manager()->GetProfileInfoCache(); |
| + size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path); |
| + return profile_index != std::string::npos && |
| + profile_info.ProfileIsSigninRequiredAtIndex(profile_index); |
| + } |
| + |
| private: |
| ProfileManager* profile_manager_; |
| base::WeakPtrFactory<ProfileStoreImpl> weak_factory_; |