| Index: webkit/glue/webframeloaderclient_impl.cc
|
| ===================================================================
|
| --- webkit/glue/webframeloaderclient_impl.cc (revision 20851)
|
| +++ webkit/glue/webframeloaderclient_impl.cc (working copy)
|
| @@ -73,6 +73,7 @@
|
|
|
| using WebKit::WebData;
|
| using WebKit::WebNavigationType;
|
| +using WebKit::WebNavigationPolicy;
|
| using WebKit::WebString;
|
| using WebKit::WebURL;
|
| using WebKit::WebVector;
|
| @@ -95,7 +96,7 @@
|
| 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 @@
|
|
|
| // 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 @@
|
| 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 @@
|
| 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 @@
|
| // 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 @@
|
| // 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 @@
|
| 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 @@
|
| 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;
|
| }
|
|
|
|
|