summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 21:51:38 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 21:51:38 +0000
commitb27cd37ab21786afdeeb0169b2a1943df5cf6b46 (patch)
tree639aab810c4676c0c12f1d9436dd4fdd27c85aff /webkit/glue
parent24f60e48f7d828cdc40fe17b9ff3f71ef210c455 (diff)
downloadchromium_src-b27cd37ab21786afdeeb0169b2a1943df5cf6b46.zip
chromium_src-b27cd37ab21786afdeeb0169b2a1943df5cf6b46.tar.gz
chromium_src-b27cd37ab21786afdeeb0169b2a1943df5cf6b46.tar.bz2
Reverting 28599.
Review URL: http://codereview.chromium.org/272017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/chrome_client_impl.cc94
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc98
-rw-r--r--webkit/glue/webframeloaderclient_impl.h8
3 files changed, 108 insertions, 92 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 5e5349f..691340d 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -28,6 +28,7 @@
#endif
#undef LOG
+#include "googleurl/src/gurl.h"
#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebCursorInfo.h"
#include "webkit/api/public/WebFileChooserCompletion.h"
@@ -88,16 +89,17 @@ void ChromeClientImpl::chromeDestroyed() {
}
void ChromeClientImpl::setWindowRect(const WebCore::FloatRect& r) {
- if (webview_->client()) {
- webview_->client()->setWindowRect(
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate) {
+ delegate->setWindowRect(
webkit_glue::IntRectToWebRect(WebCore::IntRect(r)));
}
}
WebCore::FloatRect ChromeClientImpl::windowRect() {
WebRect rect;
- if (webview_->client()) {
- rect = webview_->client()->rootWindowRect();
+ if (webview_->delegate()) {
+ rect = webview_->delegate()->rootWindowRect();
} else {
// These numbers will be fairly wrong. The window's x/y coordinates will
// be the top left corner of the screen and the size will be the content
@@ -127,40 +129,41 @@ float ChromeClientImpl::scaleFactor() {
}
void ChromeClientImpl::focus() {
- if (!webview_->client())
- return;
-
- webview_->client()->didFocus();
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate) {
+ delegate->didFocus();
- // If accessibility is enabled, we should notify assistive technology that
- // the active AccessibilityObject changed.
- const WebCore::Frame* frame = webview_->GetFocusedWebCoreFrame();
- if (!frame)
- return;
+ // If accessibility is enabled, we should notify assistive technology that
+ // the active AccessibilityObject changed.
+ const WebCore::Frame* frame = webview_->GetFocusedWebCoreFrame();
+ if (!frame)
+ return;
- WebCore::Document* doc = frame->document();
+ WebCore::Document* doc = frame->document();
- if (doc && doc->axObjectCache()->accessibilityEnabled()) {
- WebCore::Node* focused_node = webview_->GetFocusedNode();
+ if (doc && doc->axObjectCache()->accessibilityEnabled()) {
+ WebCore::Node* focused_node = webview_->GetFocusedNode();
- if (!focused_node) {
- // Could not retrieve focused Node.
- return;
- }
+ if (!focused_node) {
+ // Could not retrieve focused Node.
+ return;
+ }
- // Retrieve the focused AccessibilityObject.
- WebCore::AccessibilityObject* focused_acc_obj =
- doc->axObjectCache()->getOrCreate(focused_node->renderer());
+ // Retrieve the focused AccessibilityObject.
+ WebCore::AccessibilityObject* focused_acc_obj =
+ doc->axObjectCache()->getOrCreate(focused_node->renderer());
- // Alert assistive technology that focus changed.
- if (focused_acc_obj)
- webview_->delegate()->FocusAccessibilityObject(focused_acc_obj);
+ // Alert assistive technology that focus changed.
+ if (focused_acc_obj)
+ delegate->FocusAccessibilityObject(focused_acc_obj);
+ }
}
}
void ChromeClientImpl::unfocus() {
- if (webview_->client())
- webview_->client()->didBlur();
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate)
+ delegate->didBlur();
}
bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) {
@@ -265,12 +268,13 @@ void ChromeClientImpl::show() {
}
bool ChromeClientImpl::canRunModal() {
- return webview_->client() != NULL;
+ return webview_->delegate() != NULL;
}
void ChromeClientImpl::runModal() {
- if (webview_->client())
- webview_->client()->runModal();
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate)
+ delegate->runModal();
}
void ChromeClientImpl::setToolbarsVisible(bool value) {
@@ -328,7 +332,7 @@ void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source,
}
bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() {
- return webview_->client() != NULL;
+ return webview_->delegate() != NULL;
}
bool ChromeClientImpl::runBeforeUnloadConfirmPanel(
@@ -417,9 +421,9 @@ bool ChromeClientImpl::tabsToLinks() const {
WebCore::IntRect ChromeClientImpl::windowResizerRect() const {
WebCore::IntRect result;
- if (webview_->client()) {
+ if (webview_->delegate()) {
result = webkit_glue::WebRectToIntRect(
- webview_->client()->windowResizerRect());
+ webview_->delegate()->windowResizerRect());
}
return result;
}
@@ -430,19 +434,19 @@ void ChromeClientImpl::repaint(
// Ignore spurious calls.
if (!content_changed || paint_rect.isEmpty())
return;
- if (webview_->client()) {
- webview_->client()->didInvalidateRect(
- webkit_glue::IntRectToWebRect(paint_rect));
- }
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate)
+ delegate->didInvalidateRect(webkit_glue::IntRectToWebRect(paint_rect));
}
void ChromeClientImpl::scroll(
const WebCore::IntSize& scroll_delta, const WebCore::IntRect& scroll_rect,
const WebCore::IntRect& clip_rect) {
- if (webview_->client()) {
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate) {
int dx = scroll_delta.width();
int dy = scroll_delta.height();
- webview_->client()->didScrollRect(
+ delegate->didScrollRect(
dx, dy, webkit_glue::IntRectToWebRect(clip_rect));
}
}
@@ -457,8 +461,9 @@ WebCore::IntRect ChromeClientImpl::windowToScreen(
const WebCore::IntRect& rect) const {
WebCore::IntRect screen_rect(rect);
- if (webview_->client()) {
- WebRect window_rect = webview_->client()->windowRect();
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate) {
+ WebRect window_rect = delegate->windowRect();
screen_rect.move(window_rect.x, window_rect.y);
}
@@ -564,8 +569,9 @@ void ChromeClientImpl::SetCursor(const WebCursorInfo& cursor) {
return;
}
- if (webview_->client())
- webview_->client()->didChangeCursor(cursor);
+ WebViewDelegate* delegate = webview_->delegate();
+ if (delegate)
+ delegate->didChangeCursor(cursor);
}
void ChromeClientImpl::SetCursorForPlugin(const WebCursorInfo& cursor) {
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 826625dd..0841657 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -4,6 +4,9 @@
#include "config.h"
+#include <string>
+#include <vector>
+
#include "Chrome.h"
#include "CString.h"
#include "Document.h"
@@ -24,6 +27,9 @@
#include "WindowFeatures.h"
#undef LOG
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/string_util.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
#include "webkit/api/public/WebForm.h"
@@ -41,14 +47,19 @@
#include "webkit/api/src/WrappedResourceRequest.h"
#include "webkit/api/src/WrappedResourceResponse.h"
#include "webkit/glue/glue_util.h"
+#include "webkit/glue/plugins/plugin_list.h"
#include "webkit/glue/webdevtoolsagent_impl.h"
#include "webkit/glue/webframe_impl.h"
#include "webkit/glue/webframeloaderclient_impl.h"
#include "webkit/glue/webkit_glue.h"
+#include "webkit/glue/webview_delegate.h"
#include "webkit/glue/webview_impl.h"
using namespace WebCore;
+using base::Time;
+using base::TimeDelta;
+
using WebKit::WebData;
using WebKit::WebDataSourceImpl;
using WebKit::WebNavigationType;
@@ -418,8 +429,7 @@ void WebFrameLoaderClient::dispatchDidHandleOnloadEvents() {
void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() {
WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (!ds) {
- // Got a server redirect when there is no provisional DS!
- ASSERT_NOT_REACHED();
+ NOTREACHED() << "Got a server redirect when there is no provisional DS";
return;
}
@@ -429,13 +439,13 @@ void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
// A provisional load should have started already, which should have put an
// entry in our redirect chain.
- ASSERT(ds->hasRedirectChain());
+ DCHECK(ds->hasRedirectChain());
// The URL of the destination is on the provisional data source. We also need
// to update the redirect chain to account for this addition (we do this
// before the callback so the callback can look at the redirect chain to see
// what happened).
- ds->appendRedirect(webkit_glue::WebURLToKURL(ds->request().url()));
+ ds->appendRedirect(ds->request().url());
if (webframe_->client())
webframe_->client()->didReceiveServerRedirectForProvisionalLoad(webframe_);
@@ -445,8 +455,8 @@ void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
void WebFrameLoaderClient::dispatchDidCancelClientRedirect() {
// No longer expecting a client redirect.
if (webframe_->client()) {
- expected_client_redirect_src_ = KURL();
- expected_client_redirect_dest_ = KURL();
+ expected_client_redirect_src_ = GURL();
+ expected_client_redirect_dest_ = GURL();
webframe_->client()->didCancelClientRedirect(webframe_);
}
@@ -460,25 +470,26 @@ void WebFrameLoaderClient::dispatchWillPerformClientRedirect(
double fire_date) {
// Tells dispatchDidStartProvisionalLoad that if it sees this item it is a
// redirect and the source item should be added as the start of the chain.
- expected_client_redirect_src_ = webkit_glue::WebURLToKURL(webframe_->url());
- expected_client_redirect_dest_ = url;
+ expected_client_redirect_src_ = webframe_->url();
+ expected_client_redirect_dest_ = webkit_glue::KURLToGURL(url);
// TODO(timsteele): bug 1135512. Webkit does not properly notify us of
// cancelling http > file client redirects. Since the FrameLoader's policy
// is to never carry out such a navigation anyway, the best thing we can do
// for now to not get confused is ignore this notification.
- if (expected_client_redirect_dest_.isLocalFile() &&
- expected_client_redirect_src_.protocolInHTTPFamily()) {
- expected_client_redirect_src_ = KURL();
- expected_client_redirect_dest_ = KURL();
+ if (expected_client_redirect_dest_.SchemeIsFile() &&
+ (expected_client_redirect_src_.SchemeIs("http") ||
+ expected_client_redirect_src_.SchemeIsSecure())) {
+ expected_client_redirect_src_ = GURL();
+ expected_client_redirect_dest_ = GURL();
return;
}
if (webframe_->client()) {
webframe_->client()->willPerformClientRedirect(
webframe_,
- webkit_glue::KURLToWebURL(expected_client_redirect_src_),
- webkit_glue::KURLToWebURL(expected_client_redirect_dest_),
+ expected_client_redirect_src_,
+ expected_client_redirect_dest_,
static_cast<unsigned int>(interval),
static_cast<unsigned int>(fire_date));
}
@@ -492,10 +503,10 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
webview->client()->didStartLoading();
WebDataSourceImpl* ds = webframe_->GetDataSourceImpl();
- ASSERT(ds); // Should not be null when navigating to a reference fragment!
+ DCHECK(ds) << "DataSource NULL when navigating to reference fragment";
if (ds) {
- KURL url = webkit_glue::WebURLToKURL(ds->request().url());
- KURL chain_end = ds->endOfRedirectChain();
+ GURL url = ds->request().url();
+ GURL chain_end = ds->endOfRedirectChain();
ds->clearRedirectChain();
// Figure out if this location change is because of a JS-initiated client
@@ -512,15 +523,13 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
!webframe_->isProcessingUserGesture();
if (was_client_redirect) {
- if (webframe_->client()) {
- webframe_->client()->didCompleteClientRedirect(
- webframe_, webkit_glue::KURLToWebURL(chain_end));
- }
+ if (webframe_->client())
+ webframe_->client()->didCompleteClientRedirect(webframe_, chain_end);
ds->appendRedirect(chain_end);
// Make sure we clear the expected redirect since we just effectively
// completed it.
- expected_client_redirect_src_ = KURL();
- expected_client_redirect_dest_ = KURL();
+ expected_client_redirect_src_ = GURL();
+ expected_client_redirect_dest_ = GURL();
}
// Regardless of how we got here, we are navigating to a URL so we need to
@@ -557,24 +566,24 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() {
// See dispatchDidReceiveServerRedirectForProvisionalLoad.
WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (!ds) {
- ASSERT_NOT_REACHED();
+ NOTREACHED() << "Attempting to provisional load but there isn't one";
return;
}
- KURL url = webkit_glue::WebURLToKURL(ds->request().url());
+ GURL url = ds->request().url();
// Since the provisional load just started, we should have not gotten
// any redirects yet.
- ASSERT(!ds->hasRedirectChain());
+ DCHECK(!ds->hasRedirectChain());
// If this load is what we expected from a client redirect, treat it as a
// redirect from that original page. The expected redirect urls will be
// cleared by DidCancelClientRedirect.
bool completing_client_redirect = false;
- if (expected_client_redirect_src_.isValid()) {
+ if (expected_client_redirect_src_.is_valid()) {
// expected_client_redirect_dest_ could be something like
// "javascript:history.go(-1)" thus we need to exclude url starts with
// "javascript:". See bug: 1080873
- ASSERT(expected_client_redirect_dest_.protocolIs("javascript") ||
+ DCHECK(expected_client_redirect_dest_.SchemeIs("javascript") ||
expected_client_redirect_dest_ == url);
ds->appendRedirect(expected_client_redirect_src_);
completing_client_redirect = true;
@@ -590,7 +599,7 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() {
webframe_->client()->didStartProvisionalLoad(webframe_);
if (completing_client_redirect)
webframe_->client()->didCompleteClientRedirect(
- webframe_, webkit_glue::KURLToWebURL(expected_client_redirect_src_));
+ webframe_, expected_client_redirect_src_);
}
}
@@ -676,7 +685,7 @@ Frame* WebFrameLoaderClient::dispatchCreatePage() {
// Make sure that we have a valid disposition. This should have been set in
// the preceeding call to dispatchDecidePolicyForNewWindowAction.
- ASSERT(next_navigation_policy_ != WebKit::WebNavigationPolicyIgnore);
+ DCHECK(next_navigation_policy_ != WebKit::WebNavigationPolicyIgnore);
WebNavigationPolicy policy = next_navigation_policy_;
next_navigation_policy_ = WebKit::WebNavigationPolicyIgnore;
@@ -690,8 +699,9 @@ Frame* WebFrameLoaderClient::dispatchCreatePage() {
void WebFrameLoaderClient::dispatchShow() {
WebViewImpl* webview = webframe_->GetWebViewImpl();
- if (webview && webview->client())
- webview->client()->show(webview->initial_navigation_policy());
+ WebViewDelegate* d = webview->delegate();
+ if (d)
+ d->show(webview->initial_navigation_policy());
}
static bool TreatAsAttachment(const ResourceResponse& response) {
@@ -799,8 +809,8 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
// Give the delegate a chance to change the navigation policy.
const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (ds) {
- KURL url = webkit_glue::WebURLToKURL(ds->request().url());
- if (url.protocolIs(webkit_glue::kBackForwardNavigationScheme)) {
+ GURL url = ds->request().url();
+ if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) {
HandleBackForwardNavigation(url);
navigation_policy = WebKit::WebNavigationPolicyIgnore;
} else {
@@ -1142,8 +1152,7 @@ String WebFrameLoaderClient::userAgent(const KURL& url) {
}
void WebFrameLoaderClient::savePlatformDataToCachedFrame(WebCore::CachedFrame*) {
- // The page cache should be disabled.
- ASSERT_NOT_REACHED();
+ NOTREACHED() << "Page cache should be disabled";
}
void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) {
@@ -1168,7 +1177,7 @@ void WebFrameLoaderClient::download(ResourceHandle* handle,
const ResourceRequest& request,
const ResourceRequest& initialRequest,
const ResourceResponse& response) {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
PassRefPtr<Frame> WebFrameLoaderClient::createFrame(
@@ -1237,7 +1246,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(
// (e.g., acrobat reader).
void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) {
plugin_widget_ = static_cast<WebPluginContainerImpl*>(pluginWidget);
- ASSERT(plugin_widget_.get());
+ DCHECK(plugin_widget_.get());
}
PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(
@@ -1284,7 +1293,8 @@ ObjectContentType WebFrameLoaderClient::objectContentType(
String WebFrameLoaderClient::overrideMediaType() const {
// FIXME
- return String();
+ String rv;
+ return rv;
}
bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy(
@@ -1300,12 +1310,12 @@ bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy(
policy);
}
-void WebFrameLoaderClient::HandleBackForwardNavigation(const KURL& url) {
- ASSERT(url.protocolIs(webkit_glue::kBackForwardNavigationScheme));
+void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) {
+ DCHECK(url.SchemeIs(webkit_glue::kBackForwardNavigationScheme));
- bool ok;
- int offset = url.lastPathComponent().toIntStrict(&ok);
- if (!ok)
+ std::string offset_str = url.ExtractFileName();
+ int offset;
+ if (!StringToInt(offset_str, &offset))
return;
WebViewImpl* webview = webframe_->GetWebViewImpl();
diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h
index aad5d8f..becfab8 100644
--- a/webkit/glue/webframeloaderclient_impl.h
+++ b/webkit/glue/webframeloaderclient_impl.h
@@ -6,10 +6,10 @@
#define WEBKIT_GLUE_WEBFRAMELOADERCLIENT_IMPL_H_
#include "FrameLoaderClient.h"
-#include "KURL.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
+#include "googleurl/src/gurl.h"
#include "webkit/api/public/WebNavigationPolicy.h"
#include "webkit/glue/webview_delegate.h"
@@ -209,7 +209,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
WebKit::WebNavigationPolicy* policy);
// Called when a dummy back-forward navigation is intercepted.
- void HandleBackForwardNavigation(const WebCore::KURL&);
+ void HandleBackForwardNavigation(const GURL&);
PassOwnPtr<WebKit::WebPluginLoadObserver> GetPluginLoadObserver();
@@ -228,8 +228,8 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
// and the dest URL matches that load, we know that it was the result of a
// previous client redirect and the source should be added as a redirect.
// Both should be empty if unused.
- WebCore::KURL expected_client_redirect_src_;
- WebCore::KURL expected_client_redirect_dest_;
+ GURL expected_client_redirect_src_;
+ GURL expected_client_redirect_dest_;
// Contains a pointer to the plugin widget.
WTF::RefPtr<WebKit::WebPluginContainerImpl> plugin_widget_;