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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm

Issue 14242004: Speculative fix for instant overlay crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
Index: chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
diff --git a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
index 34b6a824b49d915446ff7759bb823ecc2a858301..b5c04ceeef0a577952a4667a988da394b6203f0b 100644
--- a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm
@@ -13,6 +13,8 @@
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
InstantOverlayControllerMac::InstantOverlayControllerMac(
Browser* browser,
@@ -69,4 +71,20 @@ void InstantOverlayControllerMac::OverlayStateChanged(
}
[window_ updateBookmarkBarStateForInstantOverlay];
+
+ registrar_.RemoveAll();
+ if (model.GetOverlayContents()) {
+ registrar_.Add(
+ this,
+ content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
+ content::Source<content::WebContents>(model.GetOverlayContents()));
+ }
+}
+
+void InstantOverlayControllerMac::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ [overlay_ onWebContentsDestroyed:
+ content::Source<content::WebContents>(source).ptr()];
}

Powered by Google App Engine
This is Rietveld 408576698