| Index: content/shell/shell.cc
|
| diff --git a/content/shell/shell.cc b/content/shell/shell.cc
|
| index ff14a7c6af0501a95839aa0d850cbbf0ee1a1737..7cf568e0676fd148a362863bc29ea6091ea1d6b0 100644
|
| --- a/content/shell/shell.cc
|
| +++ b/content/shell/shell.cc
|
| @@ -43,7 +43,8 @@ base::Callback<void(Shell*)> Shell::shell_created_callback_;
|
| bool Shell::quit_message_loop_ = true;
|
|
|
| Shell::Shell(WebContents* web_contents)
|
| - : devtools_frontend_(NULL),
|
| + : WebContentsObserver(NULL), // Watch DevTools WebContents, not the above.
|
| + devtools_frontend_(NULL),
|
| is_fullscreen_(false),
|
| window_(NULL),
|
| url_edit_view_(NULL),
|
| @@ -192,19 +193,14 @@ void Shell::ShowDevTools() {
|
| return;
|
| }
|
| devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents());
|
| - registrar_.Add(this,
|
| - NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - Source<WebContents>(
|
| - devtools_frontend_->frontend_shell()->web_contents()));
|
| + WebContentsObserver::Observe(
|
| + devtools_frontend_->frontend_shell()->web_contents());
|
| }
|
|
|
| void Shell::CloseDevTools() {
|
| if (!devtools_frontend_)
|
| return;
|
| - registrar_.Remove(this,
|
| - NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - Source<WebContents>(
|
| - devtools_frontend_->frontend_shell()->web_contents()));
|
| + WebContentsObserver::Observe(NULL);
|
| devtools_frontend_->Close();
|
| devtools_frontend_ = NULL;
|
| }
|
| @@ -310,6 +306,11 @@ void Shell::DeactivateContents(WebContents* contents) {
|
| contents->GetRenderViewHost()->Blur();
|
| }
|
|
|
| +void Shell::WebContentsDestroyed(WebContents* web_contents) {
|
| + devtools_frontend_ = NULL;
|
| + WebContentsObserver::Observe(NULL);
|
| +}
|
| +
|
| void Shell::Observe(int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) {
|
| @@ -321,9 +322,6 @@ void Shell::Observe(int type,
|
| string16 text = title->first->GetTitle();
|
| PlatformSetTitle(text);
|
| }
|
| - } else if (type == NOTIFICATION_WEB_CONTENTS_DESTROYED) {
|
| - devtools_frontend_ = NULL;
|
| - registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, source);
|
| } else {
|
| NOTREACHED();
|
| }
|
|
|