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

Unified Diff: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc

Issue 2488203003: [Extensions] Don't remove the bookmark drag event router as delegate (Closed)
Patch Set: Created 4 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index b27b6cd135a4ee1c7c5f2477e5978c8bec6d4838..cc139f9e709fdd6724bc09269314a307f256ff8c 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -291,6 +291,8 @@ BookmarkManagerPrivateDragEventRouter::BookmarkManagerPrivateDragEventRouter(
: web_contents_(web_contents),
profile_(
Profile::FromBrowserContext(web_contents_->GetBrowserContext())) {
+ // We need to guarantee the BookmarkTabHelper is created.
+ BookmarkTabHelper::CreateForWebContents(web_contents_);
BookmarkTabHelper* bookmark_tab_helper =
BookmarkTabHelper::FromWebContents(web_contents_);
bookmark_tab_helper->set_bookmark_drag_delegate(this);
@@ -298,10 +300,8 @@ BookmarkManagerPrivateDragEventRouter::BookmarkManagerPrivateDragEventRouter(
BookmarkManagerPrivateDragEventRouter::
~BookmarkManagerPrivateDragEventRouter() {
- BookmarkTabHelper* bookmark_tab_helper =
- BookmarkTabHelper::FromWebContents(web_contents_);
- if (bookmark_tab_helper->bookmark_drag_delegate() == this)
- bookmark_tab_helper->set_bookmark_drag_delegate(NULL);
+ // No need to remove ourselves as the BookmarkTabHelper's delegate, since they
+ // are both WebContentsUserData and will be deleted at the same time.
}
void BookmarkManagerPrivateDragEventRouter::MaybeCreateForWebContents(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698