| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "Chrome.h" | 10 #include "Chrome.h" |
| 11 #include "CString.h" | 11 #include "CString.h" |
| 12 #include "Document.h" | 12 #include "Document.h" |
| 13 #include "DocumentLoader.h" | 13 #include "DocumentLoader.h" |
| 14 #include "HTMLAppletElement.h" | 14 #include "HTMLAppletElement.h" |
| 15 #include "HTMLFormElement.h" // needed by FormState.h | 15 #include "HTMLFormElement.h" // needed by FormState.h |
| 16 #include "HTMLNames.h" | 16 #include "HTMLNames.h" |
| 17 #include "FormState.h" | 17 #include "FormState.h" |
| 18 #include "FrameLoader.h" | 18 #include "FrameLoader.h" |
| 19 #include "FrameLoadRequest.h" | 19 #include "FrameLoadRequest.h" |
| 20 #include "HitTestResult.h" |
| 20 #include "MIMETypeRegistry.h" | 21 #include "MIMETypeRegistry.h" |
| 21 #include "MouseEvent.h" | 22 #include "MouseEvent.h" |
| 22 #include "Page.h" | 23 #include "Page.h" |
| 23 #include "PlatformString.h" | 24 #include "PlatformString.h" |
| 24 #include "PluginData.h" | 25 #include "PluginData.h" |
| 25 #include "StringExtras.h" | 26 #include "StringExtras.h" |
| 26 #include "WindowFeatures.h" | 27 #include "WindowFeatures.h" |
| 27 #undef LOG | 28 #undef LOG |
| 28 | 29 |
| 29 #include "base/basictypes.h" | 30 #include "base/basictypes.h" |
| 30 #include "base/logging.h" | 31 #include "base/logging.h" |
| 31 #include "base/string_util.h" | 32 #include "base/string_util.h" |
| 32 #include "net/base/mime_util.h" | 33 #include "net/base/mime_util.h" |
| 33 #include "net/base/net_errors.h" | 34 #include "net/base/net_errors.h" |
| 34 #include "webkit/api/public/WebForm.h" | 35 #include "webkit/api/public/WebForm.h" |
| 35 #include "webkit/api/public/WebFrameClient.h" | 36 #include "webkit/api/public/WebFrameClient.h" |
| 37 #include "webkit/api/public/WebNode.h" |
| 36 #include "webkit/api/public/WebPlugin.h" | 38 #include "webkit/api/public/WebPlugin.h" |
| 37 #include "webkit/api/public/WebPluginParams.h" | 39 #include "webkit/api/public/WebPluginParams.h" |
| 38 #include "webkit/api/public/WebSecurityOrigin.h" | 40 #include "webkit/api/public/WebSecurityOrigin.h" |
| 39 #include "webkit/api/public/WebURL.h" | 41 #include "webkit/api/public/WebURL.h" |
| 40 #include "webkit/api/public/WebURLError.h" | 42 #include "webkit/api/public/WebURLError.h" |
| 41 #include "webkit/api/public/WebVector.h" | 43 #include "webkit/api/public/WebVector.h" |
| 42 #include "webkit/api/src/WebDataSourceImpl.h" | 44 #include "webkit/api/src/WebDataSourceImpl.h" |
| 43 #include "webkit/api/src/WebPluginContainerImpl.h" | 45 #include "webkit/api/src/WebPluginContainerImpl.h" |
| 44 #include "webkit/api/src/WebPluginLoadObserver.h" | 46 #include "webkit/api/src/WebPluginLoadObserver.h" |
| 45 #include "webkit/api/src/WrappedResourceRequest.h" | 47 #include "webkit/api/src/WrappedResourceRequest.h" |
| 46 #include "webkit/api/src/WrappedResourceResponse.h" | 48 #include "webkit/api/src/WrappedResourceResponse.h" |
| 47 #include "webkit/glue/glue_util.h" | 49 #include "webkit/glue/glue_util.h" |
| 48 #include "webkit/glue/plugins/plugin_list.h" | 50 #include "webkit/glue/plugins/plugin_list.h" |
| 49 #include "webkit/glue/webdevtoolsagent_impl.h" | 51 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 50 #include "webkit/glue/webframe_impl.h" | 52 #include "webkit/glue/webframe_impl.h" |
| 51 #include "webkit/glue/webframeloaderclient_impl.h" | 53 #include "webkit/glue/webframeloaderclient_impl.h" |
| 52 #include "webkit/glue/webkit_glue.h" | 54 #include "webkit/glue/webkit_glue.h" |
| 53 #include "webkit/glue/webview_delegate.h" | 55 #include "webkit/glue/webview_delegate.h" |
| 54 #include "webkit/glue/webview_impl.h" | 56 #include "webkit/glue/webview_impl.h" |
| 55 | 57 |
| 56 using namespace WebCore; | 58 using namespace WebCore; |
| 57 | 59 |
| 58 using base::Time; | 60 using base::Time; |
| 59 using base::TimeDelta; | 61 using base::TimeDelta; |
| 60 | 62 |
| 61 using WebKit::WebData; | 63 using WebKit::WebData; |
| 62 using WebKit::WebDataSourceImpl; | 64 using WebKit::WebDataSourceImpl; |
| 63 using WebKit::WebNavigationType; | 65 using WebKit::WebNavigationType; |
| 64 using WebKit::WebNavigationPolicy; | 66 using WebKit::WebNavigationPolicy; |
| 67 using WebKit::WebNode; |
| 65 using WebKit::WebPlugin; | 68 using WebKit::WebPlugin; |
| 66 using WebKit::WebPluginContainerImpl; | 69 using WebKit::WebPluginContainerImpl; |
| 67 using WebKit::WebPluginLoadObserver; | 70 using WebKit::WebPluginLoadObserver; |
| 68 using WebKit::WebPluginParams; | 71 using WebKit::WebPluginParams; |
| 69 using WebKit::WebString; | 72 using WebKit::WebString; |
| 70 using WebKit::WebURL; | 73 using WebKit::WebURL; |
| 71 using WebKit::WebURLError; | 74 using WebKit::WebURLError; |
| 72 using WebKit::WebURLRequest; | 75 using WebKit::WebURLRequest; |
| 73 using WebKit::WebVector; | 76 using WebKit::WebVector; |
| 74 using WebKit::WrappedResourceRequest; | 77 using WebKit::WrappedResourceRequest; |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 GURL url = ds->request().url(); | 821 GURL url = ds->request().url(); |
| 819 if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { | 822 if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { |
| 820 HandleBackForwardNavigation(url); | 823 HandleBackForwardNavigation(url); |
| 821 navigation_policy = WebKit::WebNavigationPolicyIgnore; | 824 navigation_policy = WebKit::WebNavigationPolicyIgnore; |
| 822 } else { | 825 } else { |
| 823 bool is_redirect = ds->hasRedirectChain(); | 826 bool is_redirect = ds->hasRedirectChain(); |
| 824 | 827 |
| 825 WebNavigationType webnav_type = | 828 WebNavigationType webnav_type = |
| 826 WebDataSourceImpl::toWebNavigationType(action.type()); | 829 WebDataSourceImpl::toWebNavigationType(action.type()); |
| 827 | 830 |
| 831 RefPtr<WebCore::Node> node; |
| 832 for (const Event* event = action.event(); event; |
| 833 event = event->underlyingEvent()) { |
| 834 if (event->isMouseEvent()) { |
| 835 const MouseEvent* mouse_event = |
| 836 static_cast<const MouseEvent*>(event); |
| 837 node = webframe_->frame()->eventHandler()->hitTestResultAtPoint( |
| 838 mouse_event->absoluteLocation(), false).innerNonSharedNode(); |
| 839 break; |
| 840 } |
| 841 } |
| 842 WebNode originating_node = webkit_glue::NodeToWebNode(node); |
| 843 |
| 828 navigation_policy = webframe_->client()->decidePolicyForNavigation( | 844 navigation_policy = webframe_->client()->decidePolicyForNavigation( |
| 829 webframe_, ds->request(), webnav_type, navigation_policy, | 845 webframe_, ds->request(), webnav_type, originating_node, |
| 830 is_redirect); | 846 navigation_policy, is_redirect); |
| 831 } | 847 } |
| 832 } | 848 } |
| 833 | 849 |
| 834 if (navigation_policy == WebKit::WebNavigationPolicyCurrentTab) { | 850 if (navigation_policy == WebKit::WebNavigationPolicyCurrentTab) { |
| 835 policy_action = PolicyUse; | 851 policy_action = PolicyUse; |
| 836 } else if (navigation_policy == WebKit::WebNavigationPolicyDownload) { | 852 } else if (navigation_policy == WebKit::WebNavigationPolicyDownload) { |
| 837 policy_action = PolicyDownload; | 853 policy_action = PolicyDownload; |
| 838 } else { | 854 } else { |
| 839 if (navigation_policy != WebKit::WebNavigationPolicyIgnore) { | 855 if (navigation_policy != WebKit::WebNavigationPolicyIgnore) { |
| 840 WrappedResourceRequest webreq(request); | 856 WrappedResourceRequest webreq(request); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 WebViewImpl* webview = webframe_->GetWebViewImpl(); | 1330 WebViewImpl* webview = webframe_->GetWebViewImpl(); |
| 1315 if (webview->client()) | 1331 if (webview->client()) |
| 1316 webview->client()->navigateBackForwardSoon(offset); | 1332 webview->client()->navigateBackForwardSoon(offset); |
| 1317 } | 1333 } |
| 1318 | 1334 |
| 1319 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver()
{ | 1335 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver()
{ |
| 1320 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( | 1336 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( |
| 1321 webframe_->frame()->loader()->activeDocumentLoader()); | 1337 webframe_->frame()->loader()->activeDocumentLoader()); |
| 1322 return ds->releasePluginLoadObserver(); | 1338 return ds->releasePluginLoadObserver(); |
| 1323 } | 1339 } |
| OLD | NEW |