Chromium Code Reviews| Index: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm |
| index 74a23a1c95446279079e6053926b7976526ee8d5..fd891d0c04a5e55e95e6932203066773beceabbc 100644 |
| --- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm |
| +++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm |
| @@ -81,7 +81,8 @@ class ExtensionPopupContainer : public ExtensionViewMac::Container { |
| class DevtoolsNotificationBridge : public content::NotificationObserver { |
| public: |
| explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) |
| - : controller_(controller) {} |
| + : controller_(controller), |
| + rvh_([controller_ extensionHost]->render_view_host()) {} |
| virtual void Observe( |
| int type, |
| @@ -96,16 +97,14 @@ class DevtoolsNotificationBridge : public content::NotificationObserver { |
| break; |
| } |
| case content::NOTIFICATION_DEVTOOLS_AGENT_ATTACHED: { |
| - RenderViewHost* rvh = [controller_ extensionHost]->render_view_host(); |
| - if (content::Details<RenderViewHost>(rvh) == details) |
| + if (content::Details<RenderViewHost>(rvh_) == details) |
| // Set the flag on the controller so the popup is not hidden when |
| // the dev tools get focus. |
| [controller_ setBeingInspected:YES]; |
| break; |
| } |
| case content::NOTIFICATION_DEVTOOLS_AGENT_DETACHED: { |
| - RenderViewHost* rvh = [controller_ extensionHost]->render_view_host(); |
| - if (content::Details<RenderViewHost>(rvh) == details) |
| + if (content::Details<RenderViewHost>(rvh_) == details) |
| // Allow the devtools to finish detaching before we close the popup |
| [controller_ performSelector:@selector(close) |
| withObject:nil |
| @@ -121,6 +120,9 @@ class DevtoolsNotificationBridge : public content::NotificationObserver { |
| private: |
| ExtensionPopupController* controller_; |
| + // RenderViewHost for controller. Hold onto this separately because we need |
| + // to know what it is when our ExtensionHost may no longer be valid. |
| + RenderViewHost* rvh_; |
|
Matt Perry
2013/03/15 22:55:46
nit: don't abbrev member vars
not at google - send to devlin
2013/03/15 23:49:53
Done.
|
| }; |
| @implementation ExtensionPopupController |
| @@ -199,10 +201,8 @@ class DevtoolsNotificationBridge : public content::NotificationObserver { |
| - (void)windowWillClose:(NSNotification *)notification { |
| [super windowWillClose:notification]; |
| gPopup = nil; |
| - if (host_->view()) { |
| + if (host_->view()) |
| host_->view()->set_container(NULL); |
| - host_.reset(); |
| - } |
| } |
| - (void)windowDidResignKey:(NSNotification*)notification { |