Remove from notification center when web contents is destroyed.
This commit is contained in:
parent
54060ed53d
commit
5e0dd5c687
4 changed files with 10 additions and 0 deletions
|
@ -15,6 +15,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
|
|||
public:
|
||||
explicit InspectableWebContentsViewMac(
|
||||
InspectableWebContentsImpl* inspectable_web_contents_impl);
|
||||
virtual ~InspectableWebContentsViewMac();
|
||||
|
||||
virtual gfx::NativeView GetNativeView() const OVERRIDE;
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
|
|
|
@ -17,6 +17,10 @@ InspectableWebContentsViewMac::InspectableWebContentsViewMac(InspectableWebConte
|
|||
view_([[BRYInspectableWebContentsView alloc] initWithInspectableWebContentsViewMac:this]) {
|
||||
}
|
||||
|
||||
InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {
|
||||
[view_ removeFromNotificationCenter];
|
||||
}
|
||||
|
||||
gfx::NativeView InspectableWebContentsViewMac::GetNativeView() const {
|
||||
return view_.get();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
BRYInspectableWebContentsViewPrivate *_private;
|
||||
}
|
||||
|
||||
- (void)removeFromNotificationCenter;
|
||||
- (IBAction)showDevTools:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -76,6 +76,10 @@ void SetActive(content::WebContents* web_contents, bool active) {
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)removeFromNotificationCenter {
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
}
|
||||
|
||||
- (IBAction)showDevTools:(id)sender {
|
||||
_private->inspectableWebContentsView->inspectable_web_contents()->ShowDevTools();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue