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( |