From c5b3b5ee82c8aa7b760acec23fa39ee61dd53152 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Fri, 13 Feb 2009 06:41:11 +0000 Subject: The WebFrame interface currently supports reference counting, but no one uses. Internally, WebFrameImpl needs reference counting, so we still define it there. Same goes for WebView and WebWidget. While making this change, I noticed that WebInspectorClient was casting WebView pointers to WebViewImpl pointers too much. By just starting with WebViewImpl pointers, things could be cleaned up considerably. R=brettw Review URL: http://codereview.chromium.org/21342 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9745 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/inspector_client_impl.cc | 37 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'webkit/glue/inspector_client_impl.cc') diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc index c3ac881..f99795b 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -28,7 +28,7 @@ static const float kDefaultInspectorYPos = 50; static const float kDefaultInspectorHeight = 640; static const float kDefaultInspectorWidth = 480; -WebInspectorClient::WebInspectorClient(WebView* webView) +WebInspectorClient::WebInspectorClient(WebViewImpl* webView) : inspected_web_view_(webView) , inspector_web_view_(0) { ASSERT(inspected_web_view_); @@ -45,7 +45,7 @@ Page* WebInspectorClient::createPage() { WebCore::Page* page; if (inspector_web_view_ != NULL) { - page = static_cast(inspector_web_view_)->page(); + page = inspector_web_view_->page(); ASSERT(page != NULL); if (page != NULL) return page; @@ -54,17 +54,16 @@ Page* WebInspectorClient::createPage() { WebViewDelegate* delegate = inspected_web_view_->GetDelegate(); if (!delegate) return NULL; - inspector_web_view_ = delegate->CreateWebView(inspected_web_view_, true); + inspector_web_view_ = static_cast( + delegate->CreateWebView(inspected_web_view_, true)); if (!inspector_web_view_) return NULL; GURL inspector_url(webkit_glue::GetInspectorURL()); scoped_ptr request(WebRequest::Create(inspector_url)); - WebViewImpl* inspector_web_view_impl = - static_cast(inspector_web_view_); - inspector_web_view_impl->main_frame()->LoadRequest(request.get()); + inspector_web_view_->main_frame()->LoadRequest(request.get()); - page = inspector_web_view_impl->page(); + page = inspector_web_view_->page(); page->chrome()->setToolbarsVisible(false); page->chrome()->setStatusbarVisible(false); @@ -92,31 +91,29 @@ Page* WebInspectorClient::createPage() { } void WebInspectorClient::showWindow() { - WebViewImpl* impl = static_cast(inspected_web_view_.get()); - InspectorController* inspector = impl->page()->inspectorController(); + InspectorController* inspector = inspected_web_view_->page()->inspectorController(); inspector->setWindowVisible(true); // Notify the webview delegate of how many resources we're inspecting. - WebViewDelegate* d = impl->delegate(); + WebViewDelegate* d = inspected_web_view_->delegate(); DCHECK(d); d->WebInspectorOpened(inspector->resources().size()); } void WebInspectorClient::closeWindow() { inspector_web_view_ = NULL; - WebViewImpl* impl = static_cast(inspected_web_view_.get()); - WebFrameImpl* frame = static_cast(impl->GetMainFrame()); + WebFrameImpl* frame = inspected_web_view_->main_frame(); if (frame && frame->inspected_node()) hideHighlight(); - if (impl->page()) - impl->page()->inspectorController()->setWindowVisible(false); + if (inspected_web_view_->page()) + inspected_web_view_->page()->inspectorController()->setWindowVisible(false); } bool WebInspectorClient::windowVisible() { if (inspector_web_view_ != NULL) { - Page* page = static_cast(inspector_web_view_)->page(); + Page* page = inspector_web_view_->page(); ASSERT(page != NULL); if (page != NULL) return true; @@ -147,21 +144,19 @@ static void invalidateNodeBoundingRect(WebViewImpl* web_view) { } void WebInspectorClient::highlight(Node* node) { - WebViewImpl* web_view = static_cast(inspected_web_view_.get()); - WebFrameImpl* frame = static_cast(web_view->GetMainFrame()); + WebFrameImpl* frame = inspected_web_view_->main_frame(); if (frame->inspected_node()) hideHighlight(); - invalidateNodeBoundingRect(web_view); + invalidateNodeBoundingRect(inspected_web_view_); frame->selectNodeFromInspector(node); } void WebInspectorClient::hideHighlight() { - WebViewImpl* web_view = static_cast(inspected_web_view_.get()); - WebFrameImpl* frame = static_cast(web_view->GetMainFrame()); + WebFrameImpl* frame = static_cast(inspected_web_view_->GetMainFrame()); - invalidateNodeBoundingRect(web_view); + invalidateNodeBoundingRect(inspected_web_view_); frame->selectNodeFromInspector(NULL); } -- cgit v1.1