diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 06:36:28 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-16 06:36:28 +0000 |
commit | 4873c7de675554a357717ddedc1fcaca2820de19 (patch) | |
tree | cd6446547d3b9d57f634187aecb1853c5ecbc8fb /webkit/glue/webframeloaderclient_impl.cc | |
parent | 3b846396a90174835320be2ff50afe8dd4e31590 (diff) | |
download | chromium_src-4873c7de675554a357717ddedc1fcaca2820de19.zip chromium_src-4873c7de675554a357717ddedc1fcaca2820de19.tar.gz chromium_src-4873c7de675554a357717ddedc1fcaca2820de19.tar.bz2 |
Reverting 20855.
Review URL: http://codereview.chromium.org/149744
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframeloaderclient_impl.cc')
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 19f1096..ffafec3 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -73,6 +73,7 @@ using base::TimeDelta; using WebKit::WebData; using WebKit::WebNavigationType; +using WebKit::WebNavigationPolicy; using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; @@ -95,7 +96,7 @@ WebFrameLoaderClient::WebFrameLoaderClient(WebFrameImpl* frame) : postpone_loading_data_(false), has_representation_(false), sent_initial_response_to_plugin_(false), - next_window_open_disposition_(IGNORE_ACTION) { + next_navigation_policy_(WebKit::WebNavigationPolicyIgnore) { } WebFrameLoaderClient::~WebFrameLoaderClient() { @@ -810,15 +811,15 @@ Frame* WebFrameLoaderClient::dispatchCreatePage() { // Make sure that we have a valid disposition. This should have been set in // the preceeding call to dispatchDecidePolicyForNewWindowAction. - DCHECK(next_window_open_disposition_ != IGNORE_ACTION); - WindowOpenDisposition disp = next_window_open_disposition_; - next_window_open_disposition_ = IGNORE_ACTION; + DCHECK(next_navigation_policy_ != WebKit::WebNavigationPolicyIgnore); + WebNavigationPolicy policy = next_navigation_policy_; + next_navigation_policy_ = WebKit::WebNavigationPolicyIgnore; // createWindow can return NULL (e.g., popup blocker denies the window). if (!new_page) return NULL; - WebViewImpl::FromPage(new_page)->set_window_open_disposition(disp); + WebViewImpl::FromPage(new_page)->set_initial_navigation_policy(policy); return new_page->mainFrame(); } @@ -826,7 +827,7 @@ void WebFrameLoaderClient::dispatchShow() { WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); if (d) - d->Show(webview, webview->window_open_disposition()); + d->show(webview->initial_navigation_policy()); } static bool TreatAsAttachment(const ResourceResponse& response) { @@ -896,12 +897,12 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction( const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WebCore::String& frame_name) { - WindowOpenDisposition disposition; - if (!ActionSpecifiesDisposition(action, &disposition)) - disposition = NEW_FOREGROUND_TAB; + WebNavigationPolicy navigation_policy; + if (!ActionSpecifiesNavigationPolicy(action, &navigation_policy)) + navigation_policy = WebKit::WebNavigationPolicyNewForegroundTab; PolicyAction policy_action; - if (disposition == SAVE_TO_DISK) { + if (navigation_policy == WebKit::WebNavigationPolicyDownload) { policy_action = PolicyDownload; } else { policy_action = PolicyUse; @@ -910,7 +911,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction( // unfortunate that WebCore does not provide us with any context when // creating or showing the new window that would allow us to avoid having // to keep this state. - next_window_open_disposition_ = disposition; + next_navigation_policy_ = navigation_policy; } (webframe_->frame()->loader()->*function)(policy_action); } @@ -929,40 +930,42 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction( // The NULL check here is to fix a crash that seems strange // (see - https://bugs.webkit.org/show_bug.cgi?id=23554). if (d && !request.url().isNull()) { - WindowOpenDisposition disposition = CURRENT_TAB; - ActionSpecifiesDisposition(action, &disposition); + WebNavigationPolicy navigation_policy = + WebKit::WebNavigationPolicyCurrentTab; + ActionSpecifiesNavigationPolicy(action, &navigation_policy); - // Give the delegate a chance to change the disposition. + // Give the delegate a chance to change the navigation policy. const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); if (ds) { GURL url = ds->request().url(); if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { HandleBackForwardNavigation(url); - disposition = IGNORE_ACTION; + navigation_policy = WebKit::WebNavigationPolicyIgnore; } else { bool is_redirect = ds->HasRedirectChain(); WebNavigationType webnav_type = WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type()); - disposition = d->DispositionForNavigationAction( - wv, webframe_, ds->request(), webnav_type, disposition, is_redirect); + navigation_policy = d->PolicyForNavigationAction( + wv, webframe_, ds->request(), webnav_type, navigation_policy, + is_redirect); } } - if (disposition == CURRENT_TAB) { + if (navigation_policy == WebKit::WebNavigationPolicyCurrentTab) { policy_action = PolicyUse; - } else if (disposition == SAVE_TO_DISK) { + } else if (navigation_policy == WebKit::WebNavigationPolicyDownload) { policy_action = PolicyDownload; } else { - if (disposition != IGNORE_ACTION) { + if (navigation_policy != WebKit::WebNavigationPolicyIgnore) { GURL referrer = webkit_glue::StringToGURL( request.httpHeaderField("Referer")); d->OpenURL(webframe_->GetWebViewImpl(), webkit_glue::KURLToGURL(request.url()), referrer, - disposition); + navigation_policy); } policy_action = PolicyIgnore; } @@ -1475,9 +1478,9 @@ String WebFrameLoaderClient::overrideMediaType() const { return rv; } -bool WebFrameLoaderClient::ActionSpecifiesDisposition( +bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy( const WebCore::NavigationAction& action, - WindowOpenDisposition* disposition) { + WebNavigationPolicy* policy) { if ((action.type() != NavigationTypeLinkClicked) || !action.event()->isMouseEvent()) return false; @@ -1493,11 +1496,20 @@ bool WebFrameLoaderClient::ActionSpecifiesDisposition( if (!new_tab_modifier && !shift && !alt) return false; - DCHECK(disposition); - if (new_tab_modifier) - *disposition = shift ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; - else - *disposition = shift ? NEW_WINDOW : SAVE_TO_DISK; + DCHECK(policy); + if (new_tab_modifier) { + if (shift) { + *policy = WebKit::WebNavigationPolicyNewForegroundTab; + } else { + *policy = WebKit::WebNavigationPolicyNewBackgroundTab; + } + } else { + if (shift) { + *policy = WebKit::WebNavigationPolicyNewWindow; + } else { + *policy = WebKit::WebNavigationPolicyDownload; + } + } return true; } |