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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 1782443006: Create LoadProfile method in profile_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/platform_notification_service_impl.cc
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index 3c125e4f60aa17f64a7ecd68622ea802852966f5..1a3e6b7d6a47d9d7b413fccea33145da269a98eb 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -101,21 +101,13 @@ void ProfileLoadedCallback(
const GURL& origin,
int64_t persistent_notification_id,
int action_index,
- bool incognito,
- Profile* profile,
- Profile::CreateStatus status) {
- if (status == Profile::CREATE_STATUS_CREATED) {
- // This is an intermediate state, we will be also called
- // again with CREATE_STATUS_INITIALIZED once everything is ready
- // so ignore it.
- return;
- }
- if (status != Profile::CREATE_STATUS_INITIALIZED) {
+ Profile* profile) {
+ if (!profile) {
+ // TODO(miguelg): Add UMA for this condition.
+ // Perhaps propagate this through PersistentNotificationStatus.
LOG(WARNING) << "Profile not loaded correctly";
return;
}
- DCHECK(profile);
- profile = incognito ? profile->GetOffTheRecordProfile() : profile;
switch (operation) {
case PlatformNotificationServiceImpl::NOTIFICATION_CLICK:
@@ -160,25 +152,10 @@ void PlatformNotificationServiceImpl::ProcessPersistentNotificationOperation(
ProfileManager* profile_manager = g_browser_process->profile_manager();
DCHECK(profile_manager);
- // ProfileManager does not offer a good interface to load a profile or
- // fail. Instead it offers a method to create the profile and simply load it
- // if it already exist. We therefore check first that the profile is there
- // and fail early otherwise.
- const base::FilePath profile_path =
- profile_manager->user_data_dir().AppendASCII(profile_id);
-
- ProfileAttributesEntry* entry = nullptr;
- if (!profile_manager->GetProfileAttributesStorage().
- GetProfileAttributesWithPath(profile_path, &entry)) {
- LOG(ERROR) << "Loading a path that does not exist";
- return;
- }
-
- profile_manager->CreateProfileAsync(
- profile_path,
+ profile_manager->LoadProfile(
+ profile_id, incognito,
base::Bind(&ProfileLoadedCallback, operation, origin,
- persistent_notification_id, action_index, incognito),
- base::string16(), std::string(), std::string());
+ persistent_notification_id, action_index));
}
void PlatformNotificationServiceImpl::OnPersistentNotificationClick(
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698