| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 WebViewImpl* wv = webframe_->GetWebViewImpl(); | 909 WebViewImpl* wv = webframe_->GetWebViewImpl(); |
| 910 WebViewDelegate* d = wv->delegate(); | 910 WebViewDelegate* d = wv->delegate(); |
| 911 // It is valid for this function to be invoked in code paths where the | 911 // It is valid for this function to be invoked in code paths where the |
| 912 // the webview is closed. | 912 // the webview is closed. |
| 913 // The NULL check here is to fix a crash that seems strange | 913 // The NULL check here is to fix a crash that seems strange |
| 914 // (see - https://bugs.webkit.org/show_bug.cgi?id=23554). | 914 // (see - https://bugs.webkit.org/show_bug.cgi?id=23554). |
| 915 if (d && !request.url().isNull()) { | 915 if (d && !request.url().isNull()) { |
| 916 WindowOpenDisposition disposition = CURRENT_TAB; | 916 WindowOpenDisposition disposition = CURRENT_TAB; |
| 917 ActionSpecifiesDisposition(action, &disposition); | 917 ActionSpecifiesDisposition(action, &disposition); |
| 918 | 918 |
| 919 // Give the delegate a chance to change the disposition. When we do not | 919 // Give the delegate a chance to change the disposition. |
| 920 // have a provisional data source here, it means that we are scrolling to | |
| 921 // an anchor in the page. We don't need to ask the WebViewDelegate about | |
| 922 // such navigations. | |
| 923 const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); | 920 const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); |
| 924 if (ds) { | 921 if (ds) { |
| 925 GURL url = ds->request().url(); | 922 GURL url = ds->request().url(); |
| 926 if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { | 923 if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { |
| 927 HandleBackForwardNavigation(url); | 924 HandleBackForwardNavigation(url); |
| 928 disposition = IGNORE_ACTION; | 925 disposition = IGNORE_ACTION; |
| 929 } else { | 926 } else { |
| 930 bool is_redirect = ds->HasRedirectChain(); | 927 bool is_redirect = ds->HasRedirectChain(); |
| 931 | 928 |
| 932 WebNavigationType webnav_type = | 929 WebNavigationType webnav_type = |
| 933 WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type()); | 930 WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type()); |
| 934 | 931 |
| 935 disposition = d->DispositionForNavigationAction( | 932 disposition = d->DispositionForNavigationAction( |
| 936 wv, webframe_, ds->request(), webnav_type, disposition, is_redirect)
; | 933 wv, webframe_, ds->request(), webnav_type, disposition, is_redirect)
; |
| 937 } | 934 } |
| 935 } |
| 938 | 936 |
| 937 if (disposition == CURRENT_TAB) { |
| 938 policy_action = PolicyUse; |
| 939 } else if (disposition == SAVE_TO_DISK) { |
| 940 policy_action = PolicyDownload; |
| 941 } else { |
| 939 if (disposition != IGNORE_ACTION) { | 942 if (disposition != IGNORE_ACTION) { |
| 940 if (disposition == CURRENT_TAB) { | 943 GURL referrer = webkit_glue::StringToGURL( |
| 941 policy_action = PolicyUse; | 944 request.httpHeaderField("Referer")); |
| 942 } else if (disposition == SAVE_TO_DISK) { | |
| 943 policy_action = PolicyDownload; | |
| 944 } else { | |
| 945 GURL referrer = webkit_glue::StringToGURL( | |
| 946 request.httpHeaderField("Referer")); | |
| 947 | 945 |
| 948 d->OpenURL(webframe_->GetWebViewImpl(), | 946 d->OpenURL(webframe_->GetWebViewImpl(), |
| 949 webkit_glue::KURLToGURL(request.url()), | 947 webkit_glue::KURLToGURL(request.url()), |
| 950 referrer, | 948 referrer, |
| 951 disposition); | 949 disposition); |
| 952 policy_action = PolicyIgnore; | |
| 953 } | |
| 954 } else { | |
| 955 policy_action = PolicyIgnore; | |
| 956 } | 950 } |
| 951 policy_action = PolicyIgnore; |
| 957 } | 952 } |
| 958 } else { | |
| 959 policy_action = PolicyIgnore; | |
| 960 } | 953 } |
| 961 | 954 |
| 962 (webframe_->frame()->loader()->*function)(policy_action); | 955 (webframe_->frame()->loader()->*function)(policy_action); |
| 963 } | 956 } |
| 964 | 957 |
| 965 void WebFrameLoaderClient::cancelPolicyCheck() { | 958 void WebFrameLoaderClient::cancelPolicyCheck() { |
| 966 // FIXME | 959 // FIXME |
| 967 } | 960 } |
| 968 | 961 |
| 969 void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
{ | 962 void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
{ |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 | 1500 |
| 1508 std::string offset_str = url.ExtractFileName(); | 1501 std::string offset_str = url.ExtractFileName(); |
| 1509 int offset; | 1502 int offset; |
| 1510 if (!StringToInt(offset_str, &offset)) | 1503 if (!StringToInt(offset_str, &offset)) |
| 1511 return; | 1504 return; |
| 1512 | 1505 |
| 1513 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); | 1506 WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); |
| 1514 if (d) | 1507 if (d) |
| 1515 d->NavigateBackForwardSoon(offset); | 1508 d->NavigateBackForwardSoon(offset); |
| 1516 } | 1509 } |
| OLD | NEW |