Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: chrome/browser/profiles/profile_loader.cc

Issue 16766003: Move ProfileLoader to chrome/browser/profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gyp-def out profile_loader* on android Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_loader.h ('k') | chrome/browser/profiles/profile_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_loader.cc
diff --git a/chrome/browser/ui/app_list/profile_loader.cc b/chrome/browser/profiles/profile_loader.cc
similarity index 78%
rename from chrome/browser/ui/app_list/profile_loader.cc
rename to chrome/browser/profiles/profile_loader.cc
index 4654cf2c4611f76fab6711e2aa28abad5fbd0ba1..f7ada5e7f3fbaeaab171b827a8ac5129d6a4c4a1 100644
--- a/chrome/browser/ui/app_list/profile_loader.cc
+++ b/chrome/browser/profiles/profile_loader.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/app_list/profile_loader.h"
+#include "chrome/browser/profiles/profile_loader.h"
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -20,25 +20,27 @@ ProfileLoader::ProfileLoader(ProfileManager* profile_manager)
ProfileLoader::~ProfileLoader() {
}
-bool ProfileLoader::AnyProfilesLoading() const {
+bool ProfileLoader::IsAnyProfileLoading() const {
return pending_profile_loads_ > 0;
}
void ProfileLoader::InvalidatePendingProfileLoads() {
- profile_load_sequence_id_++;
+ ++profile_load_sequence_id_;
}
void ProfileLoader::LoadProfileInvalidatingOtherLoads(
const base::FilePath& profile_file_path,
base::Callback<void(Profile*)> callback) {
- Profile* profile = profile_manager_->GetProfileByPath(profile_file_path);
+ InvalidatePendingProfileLoads();
+
+ Profile* profile = GetProfileByPath(profile_file_path);
if (profile) {
callback.Run(profile);
return;
}
IncrementPendingProfileLoads();
- profile_manager_->CreateProfileAsync(
+ CreateProfileAsync(
profile_file_path,
base::Bind(&ProfileLoader::OnProfileLoaded,
weak_factory_.GetWeakPtr(),
@@ -47,6 +49,20 @@ void ProfileLoader::LoadProfileInvalidatingOtherLoads(
string16(), string16(), false);
}
+Profile* ProfileLoader::GetProfileByPath(const base::FilePath& path) {
+ return profile_manager_->GetProfileByPath(path);
+}
+
+void ProfileLoader::CreateProfileAsync(
+ const base::FilePath& profile_path,
+ const ProfileManager::CreateCallback& callback,
+ const string16& name,
+ const string16& icon_url,
+ bool is_managed) {
+ profile_manager_->CreateProfileAsync(
+ profile_path, callback, name, icon_url, is_managed);
+}
+
void ProfileLoader::OnProfileLoaded(int profile_load_sequence_id,
base::Callback<void(Profile*)> callback,
Profile* profile,
« no previous file with comments | « chrome/browser/profiles/profile_loader.h ('k') | chrome/browser/profiles/profile_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698