Chromium Code Reviews| Index: content/browser/tab_contents/tab_contents.cc |
| diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc |
| index cc805054f208b971cb56e8f7554f03984c3bdc26..ce69c9777be6cc7bca7af3f6de5e5139fe396eb7 100644 |
| --- a/content/browser/tab_contents/tab_contents.cc |
| +++ b/content/browser/tab_contents/tab_contents.cc |
| @@ -217,8 +217,10 @@ TabContents::~TabContents() { |
| registrar_.RemoveAll(); |
| // Clear out any JavaScript state. |
| - if (delegate_) |
| + if (delegate_) { |
| delegate_->GetJavaScriptDialogCreator()->ResetJavaScriptState(this); |
| + set_delegate(NULL); |
|
sky
2011/06/23 18:51:27
You should do this last. It's possible some of the
cbentzel
2011/06/23 19:09:57
Done.
|
| + } |
| NotifyDisconnected(); |
| @@ -623,6 +625,19 @@ void TabContents::AddNewContents(TabContents* new_contents, |
| user_gesture); |
| } |
| +void TabContents::set_delegate(TabContentsDelegate* delegate) { |
|
sky
2011/06/23 18:51:27
Add a TODO about either removing debugging code, o
cbentzel
2011/06/23 19:09:57
Done.
|
| + if (delegate == delegate_) |
|
cbentzel
2011/06/23 19:09:57
Also, compacted vertical whitespace of set_delegat
|
| + return; |
| + |
| + if (delegate_) |
| + delegate_->Detach(this); |
| + |
| + delegate_ = delegate; |
| + |
| + if (delegate_) |
| + delegate_->Attach(this); |
| +} |
| + |
| gfx::NativeView TabContents::GetContentNativeView() const { |
| return view_->GetContentNativeView(); |
| } |