Index: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc |
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc |
index 6743edad21a70b212122b41a60ae9532e52f52fb..e1fbce3b7c31c69e362af3c934d7368758772fac 100644 |
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc |
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc |
@@ -98,14 +98,7 @@ bool BookmarksFunction::RunAsync() { |
return true; |
} |
- bool success = RunOnReady(); |
- if (success) { |
- content::NotificationService::current()->Notify( |
- extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, |
- content::Source<const Extension>(extension()), |
- content::Details<const BookmarksFunction>(this)); |
- } |
- SendResponse(success); |
+ RunAndSendResponse(); |
return true; |
} |
@@ -229,10 +222,21 @@ void BookmarksFunction::BookmarkModelChanged() { |
void BookmarksFunction::BookmarkModelLoaded(BookmarkModel* model, |
bool ids_reassigned) { |
model->RemoveObserver(this); |
- RunOnReady(); |
+ RunAndSendResponse(); |
Release(); // Balanced in RunOnReady(). |
} |
+void BookmarksFunction::RunAndSendResponse() { |
+ bool success = RunOnReady(); |
+ if (success) { |
+ content::NotificationService::current()->Notify( |
+ extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, |
+ content::Source<const Extension>(extension()), |
+ content::Details<const BookmarksFunction>(this)); |
+ } |
+ SendResponse(success); |
+} |
+ |
BookmarkEventRouter::BookmarkEventRouter(Profile* profile) |
: browser_context_(profile), |
model_(BookmarkModelFactory::GetForProfile(profile)), |