OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/profile_loader.h" | 5 #include "chrome/browser/ui/app_list/profile_loader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "chrome/browser/lifetime/keep_alive_types.h" | 9 #include "chrome/browser/lifetime/keep_alive_types.h" |
10 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 10 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 ++profile_load_sequence_id_; | 29 ++profile_load_sequence_id_; |
30 } | 30 } |
31 | 31 |
32 void ProfileLoader::LoadProfileInvalidatingOtherLoads( | 32 void ProfileLoader::LoadProfileInvalidatingOtherLoads( |
33 const base::FilePath& profile_file_path, | 33 const base::FilePath& profile_file_path, |
34 base::Callback<void(Profile*)> callback) { | 34 base::Callback<void(Profile*)> callback) { |
35 InvalidatePendingProfileLoads(); | 35 InvalidatePendingProfileLoads(); |
36 | 36 |
37 if (profile_store_->IsProfileLocked(profile_file_path)) { | 37 if (profile_store_->IsProfileLocked(profile_file_path)) { |
38 UserManager::Show(base::FilePath(), | 38 UserManager::Show(base::FilePath(), |
39 profiles::USER_MANAGER_NO_TUTORIAL, | |
40 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER); | 39 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER); |
41 return; | 40 return; |
42 } | 41 } |
43 | 42 |
44 Profile* profile = profile_store_->GetProfileByPath(profile_file_path); | 43 Profile* profile = profile_store_->GetProfileByPath(profile_file_path); |
45 if (profile) { | 44 if (profile) { |
46 callback.Run(profile); | 45 callback.Run(profile); |
47 return; | 46 return; |
48 } | 47 } |
49 | 48 |
(...skipping 19 matching lines...) Expand all Loading... |
69 if (pending_profile_loads_ == 1) | 68 if (pending_profile_loads_ == 1) |
70 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::PROFILE_LOADER, | 69 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::PROFILE_LOADER, |
71 KeepAliveRestartOption::DISABLED)); | 70 KeepAliveRestartOption::DISABLED)); |
72 } | 71 } |
73 | 72 |
74 void ProfileLoader::DecrementPendingProfileLoads() { | 73 void ProfileLoader::DecrementPendingProfileLoads() { |
75 pending_profile_loads_--; | 74 pending_profile_loads_--; |
76 if (pending_profile_loads_ == 0) | 75 if (pending_profile_loads_ == 0) |
77 keep_alive_.reset(); | 76 keep_alive_.reset(); |
78 } | 77 } |
OLD | NEW |