summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 09:59:05 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 09:59:05 +0000
commit1f233429e98ad6bebaeec14518b6466c5e7c08af (patch)
tree7815b8357db11761f23f6228e8ed0b5dfba2c71d
parent23f4d27695261961871a87a7014018582e016393 (diff)
downloadchromium_src-1f233429e98ad6bebaeec14518b6466c5e7c08af.zip
chromium_src-1f233429e98ad6bebaeec14518b6466c5e7c08af.tar.gz
chromium_src-1f233429e98ad6bebaeec14518b6466c5e7c08af.tar.bz2
DevTools: call InspectorController.close on detach to remove DOM listeners set by the DOM agent.
BUG=20482 Review URL: http://codereview.chromium.org/182009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24728 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/inspector_client_impl.cc84
-rw-r--r--webkit/glue/inspector_client_impl.h3
2 files changed, 10 insertions, 77 deletions
diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc
index 3d3585e..bd8b4be 100644
--- a/webkit/glue/inspector_client_impl.cc
+++ b/webkit/glue/inspector_client_impl.cc
@@ -42,8 +42,7 @@ static const float kDefaultInspectorHeight = 640;
static const float kDefaultInspectorWidth = 480;
WebInspectorClient::WebInspectorClient(WebViewImpl* webView)
- : inspected_web_view_(webView)
- , inspector_web_view_(0) {
+ : inspected_web_view_(webView) {
ASSERT(inspected_web_view_);
}
@@ -55,90 +54,27 @@ void WebInspectorClient::inspectorDestroyed() {
}
Page* WebInspectorClient::createPage() {
- if (inspected_web_view_->GetWebDevToolsAgentImpl())
- return NULL;
-
- WebCore::Page* page;
-
- if (inspector_web_view_ != NULL) {
- page = inspector_web_view_->page();
- ASSERT(page != NULL);
- if (page != NULL)
- return page;
- }
-
- WebViewDelegate* delegate = inspected_web_view_->GetDelegate();
- if (!delegate)
- return NULL;
- inspector_web_view_ = static_cast<WebViewImpl*>(
- delegate->CreateWebView(inspected_web_view_, true, GURL()));
- if (!inspector_web_view_)
- return NULL;
-
- inspector_web_view_->main_frame()->loadRequest(
- WebURLRequest(webkit_glue::GetInspectorURL()));
-
- page = inspector_web_view_->page();
-
- page->chrome()->setToolbarsVisible(false);
- page->chrome()->setStatusbarVisible(false);
- page->chrome()->setScrollbarsVisible(false);
- page->chrome()->setMenubarVisible(false);
- page->chrome()->setResizable(true);
-
- // Don't allow inspection of inspector.
- page->settings()->setDeveloperExtrasEnabled(false);
- page->settings()->setPrivateBrowsingEnabled(true);
- page->settings()->setPluginsEnabled(false);
- page->settings()->setJavaEnabled(false);
-
- FloatRect windowRect = page->chrome()->windowRect();
- FloatSize pageSize = page->chrome()->pageRect().size();
- windowRect.setX(kDefaultInspectorXPos);
- windowRect.setY(kDefaultInspectorYPos);
- windowRect.setWidth(kDefaultInspectorHeight);
- windowRect.setHeight(kDefaultInspectorWidth);
- page->chrome()->setWindowRect(windowRect);
-
- page->chrome()->show();
-
- return page;
+ // This method should never be called in Chrome as inspector front-end lives
+ // in a separate process.
+ NOTREACHED();
+ return NULL;
}
void WebInspectorClient::showWindow() {
- if (inspected_web_view_->GetWebDevToolsAgentImpl())
- return;
-
- InspectorController* inspector = inspected_web_view_->page()->inspectorController();
+ DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
+ InspectorController* inspector =
+ inspected_web_view_->page()->inspectorController();
inspector->setWindowVisible(true);
-
- // Notify the webview delegate of how many resources we're inspecting.
- WebViewDelegate* d = inspected_web_view_->delegate();
- DCHECK(d);
}
void WebInspectorClient::closeWindow() {
- if (inspected_web_view_->GetWebDevToolsAgentImpl())
- return;
-
- inspector_web_view_ = NULL;
-
- hideHighlight();
-
+ DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
if (inspected_web_view_->page())
inspected_web_view_->page()->inspectorController()->setWindowVisible(false);
}
bool WebInspectorClient::windowVisible() {
- if (inspected_web_view_->GetWebDevToolsAgentImpl())
- return false;
-
- if (inspector_web_view_ != NULL) {
- Page* page = inspector_web_view_->page();
- ASSERT(page != NULL);
- if (page != NULL)
- return true;
- }
+ DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
return false;
}
diff --git a/webkit/glue/inspector_client_impl.h b/webkit/glue/inspector_client_impl.h
index 1d0940a..277c0ba 100644
--- a/webkit/glue/inspector_client_impl.h
+++ b/webkit/glue/inspector_client_impl.h
@@ -60,9 +60,6 @@ private:
typedef HashMap<WebCore::String, WebCore::InspectorController::Setting>
SettingsMap;
OwnPtr<SettingsMap> settings_;
-
- // The WebView of the Inspector popup window
- WebViewImpl* inspector_web_view_;
};
#endif // WEBKIT_GLUE_INSPECTOR_CLIENT_IMPL_H__