| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 } | 915 } |
| 916 | 916 |
| 917 frame()->loader().load(FrameLoadRequest(0, resourceRequest)); | 917 frame()->loader().load(FrameLoadRequest(0, resourceRequest)); |
| 918 } | 918 } |
| 919 | 919 |
| 920 void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) | 920 void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) |
| 921 { | 921 { |
| 922 ASSERT(frame()); | 922 ASSERT(frame()); |
| 923 RefPtr<HistoryItem> historyItem = PassRefPtr<HistoryItem>(item); | 923 RefPtr<HistoryItem> historyItem = PassRefPtr<HistoryItem>(item); |
| 924 ASSERT(historyItem); | 924 ASSERT(historyItem); |
| 925 | 925 frame()->page()->history()->goToItem(historyItem.get()); |
| 926 frame()->loader().prepareForHistoryNavigation(); | |
| 927 RefPtr<HistoryItem> currentItem = frame()->loader().history()->currentItem()
; | |
| 928 m_inSameDocumentHistoryLoad = currentItem && currentItem->shouldDoSameDocume
ntNavigationTo(historyItem.get()); | |
| 929 frame()->page()->goToItem(historyItem.get()); | |
| 930 m_inSameDocumentHistoryLoad = false; | |
| 931 } | 926 } |
| 932 | 927 |
| 933 void WebFrameImpl::loadData(const WebData& data, const WebString& mimeType, cons
t WebString& textEncoding, const WebURL& baseURL, const WebURL& unreachableURL,
bool replace) | 928 void WebFrameImpl::loadData(const WebData& data, const WebString& mimeType, cons
t WebString& textEncoding, const WebURL& baseURL, const WebURL& unreachableURL,
bool replace) |
| 934 { | 929 { |
| 935 ASSERT(frame()); | 930 ASSERT(frame()); |
| 936 | 931 |
| 937 // If we are loading substitute data to replace an existing load, then | 932 // If we are loading substitute data to replace an existing load, then |
| 938 // inherit all of the properties of that original request. This way, | 933 // inherit all of the properties of that original request. This way, |
| 939 // reload will re-attempt the original request. It is essential that | 934 // reload will re-attempt the original request. It is essential that |
| 940 // we only do this when there is an unreachableURL since a non-empty | 935 // we only do this when there is an unreachableURL since a non-empty |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 return DataSourceForDocLoader(frame()->loader().documentLoader()); | 986 return DataSourceForDocLoader(frame()->loader().documentLoader()); |
| 992 } | 987 } |
| 993 | 988 |
| 994 WebHistoryItem WebFrameImpl::previousHistoryItem() const | 989 WebHistoryItem WebFrameImpl::previousHistoryItem() const |
| 995 { | 990 { |
| 996 ASSERT(frame()); | 991 ASSERT(frame()); |
| 997 // We use the previous item here because documentState (filled-out forms) | 992 // We use the previous item here because documentState (filled-out forms) |
| 998 // only get saved to history when it becomes the previous item. The caller | 993 // only get saved to history when it becomes the previous item. The caller |
| 999 // is expected to query the history item after a navigation occurs, after | 994 // is expected to query the history item after a navigation occurs, after |
| 1000 // the desired history item has become the previous entry. | 995 // the desired history item has become the previous entry. |
| 1001 return WebHistoryItem(frame()->loader().history()->previousItem()); | 996 return WebHistoryItem(frame()->page()->history()->previousItemForExport(fram
e())); |
| 1002 } | 997 } |
| 1003 | 998 |
| 1004 WebHistoryItem WebFrameImpl::currentHistoryItem() const | 999 WebHistoryItem WebFrameImpl::currentHistoryItem() const |
| 1005 { | 1000 { |
| 1006 ASSERT(frame()); | 1001 ASSERT(frame()); |
| 1007 | 1002 |
| 1008 // We're shutting down. | 1003 // We're shutting down. |
| 1009 if (!frame()->loader().activeDocumentLoader()) | 1004 if (!frame()->loader().activeDocumentLoader()) |
| 1010 return WebHistoryItem(); | 1005 return WebHistoryItem(); |
| 1011 | 1006 |
| 1012 // If we are still loading, then we don't want to clobber the current | 1007 // If we are still loading, then we don't want to clobber the current |
| 1013 // history item as this could cause us to lose the scroll position and | 1008 // history item as this could cause us to lose the scroll position and |
| 1014 // document state. However, it is OK for new navigations. | 1009 // document state. However, it is OK for new navigations. |
| 1015 // FIXME: Can we make this a plain old getter, instead of worrying about | 1010 // FIXME: Can we make this a plain old getter, instead of worrying about |
| 1016 // clobbering here? | 1011 // clobbering here? |
| 1017 if (!m_inSameDocumentHistoryLoad && (frame()->loader().loadType() == FrameLo
adTypeStandard | 1012 if (!frame()->page()->history()->inSameDocumentLoad() && (frame()->loader().
loadType() == FrameLoadTypeStandard |
| 1018 || !frame()->loader().activeDocumentLoader()->isLoadingInAPISense())) | 1013 || !frame()->loader().activeDocumentLoader()->isLoadingInAPISense())) |
| 1019 frame()->loader().history()->saveDocumentAndScrollState(); | 1014 frame()->page()->history()->saveDocumentAndScrollState(frame()); |
| 1020 | 1015 |
| 1021 if (HistoryItem* item = frame()->loader().history()->provisionalItem()) | 1016 if (RefPtr<HistoryItem> item = frame()->page()->history()->provisionalItemFo
rExport(frame())) |
| 1022 return WebHistoryItem(item); | 1017 return WebHistoryItem(item); |
| 1023 return WebHistoryItem(frame()->page()->mainFrame()->loader().history()->curr
entItem()); | 1018 return WebHistoryItem(frame()->page()->history()->currentItemForExport(frame
())); |
| 1024 } | 1019 } |
| 1025 | 1020 |
| 1026 void WebFrameImpl::enableViewSourceMode(bool enable) | 1021 void WebFrameImpl::enableViewSourceMode(bool enable) |
| 1027 { | 1022 { |
| 1028 if (frame()) | 1023 if (frame()) |
| 1029 frame()->setInViewSourceMode(enable); | 1024 frame()->setInViewSourceMode(enable); |
| 1030 } | 1025 } |
| 1031 | 1026 |
| 1032 bool WebFrameImpl::isViewSourceModeEnabled() const | 1027 bool WebFrameImpl::isViewSourceModeEnabled() const |
| 1033 { | 1028 { |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 , m_resumeScopingFromRange(0) | 2092 , m_resumeScopingFromRange(0) |
| 2098 , m_lastMatchCount(-1) | 2093 , m_lastMatchCount(-1) |
| 2099 , m_totalMatchCount(-1) | 2094 , m_totalMatchCount(-1) |
| 2100 , m_framesScopingCount(-1) | 2095 , m_framesScopingCount(-1) |
| 2101 , m_findRequestIdentifier(-1) | 2096 , m_findRequestIdentifier(-1) |
| 2102 , m_scopingInProgress(false) | 2097 , m_scopingInProgress(false) |
| 2103 , m_lastFindRequestCompletedWithNoMatches(false) | 2098 , m_lastFindRequestCompletedWithNoMatches(false) |
| 2104 , m_nextInvalidateAfter(0) | 2099 , m_nextInvalidateAfter(0) |
| 2105 , m_findMatchMarkersVersion(0) | 2100 , m_findMatchMarkersVersion(0) |
| 2106 , m_findMatchRectsAreValid(false) | 2101 , m_findMatchRectsAreValid(false) |
| 2107 , m_inSameDocumentHistoryLoad(false) | |
| 2108 , m_inputEventsScaleFactorForEmulation(1) | 2102 , m_inputEventsScaleFactorForEmulation(1) |
| 2109 { | 2103 { |
| 2110 blink::Platform::current()->incrementStatsCounter(webFrameActiveCount); | 2104 blink::Platform::current()->incrementStatsCounter(webFrameActiveCount); |
| 2111 frameCount++; | 2105 frameCount++; |
| 2112 } | 2106 } |
| 2113 | 2107 |
| 2114 WebFrameImpl::~WebFrameImpl() | 2108 WebFrameImpl::~WebFrameImpl() |
| 2115 { | 2109 { |
| 2116 blink::Platform::current()->decrementStatsCounter(webFrameActiveCount); | 2110 blink::Platform::current()->decrementStatsCounter(webFrameActiveCount); |
| 2117 frameCount--; | 2111 frameCount--; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 // onload event handler. | 2180 // onload event handler. |
| 2187 // Because the event handler may set webframe->mFrame to null, | 2181 // Because the event handler may set webframe->mFrame to null, |
| 2188 // it is necessary to check the value after calling init() and | 2182 // it is necessary to check the value after calling init() and |
| 2189 // return without loading URL. | 2183 // return without loading URL. |
| 2190 // NOTE: m_client will be null if this frame has been detached. | 2184 // NOTE: m_client will be null if this frame has been detached. |
| 2191 // (b:791612) | 2185 // (b:791612) |
| 2192 childFrame->init(); // create an empty document | 2186 childFrame->init(); // create an empty document |
| 2193 if (!childFrame->tree().parent()) | 2187 if (!childFrame->tree().parent()) |
| 2194 return 0; | 2188 return 0; |
| 2195 | 2189 |
| 2196 HistoryItem* parentItem = frame()->loader().history()->currentItem(); | |
| 2197 HistoryItem* childItem = 0; | 2190 HistoryItem* childItem = 0; |
| 2198 // If we're moving in the back/forward list, we might want to replace the co
ntent | 2191 // If we're moving in the back/forward list, we might want to replace the co
ntent |
| 2199 // of this child frame with whatever was there at that point. | 2192 // of this child frame with whatever was there at that point. |
| 2200 if (parentItem && parentItem->children().size() && isBackForwardLoadType(fra
me()->loader().loadType()) && !frame()->document()->loadEventFinished()) | 2193 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen
t()->loadEventFinished()) |
| 2201 childItem = parentItem->childItemWithTarget(childFrame->tree().uniqueNam
e()); | 2194 childItem = frame()->page()->history()->currentItem(childFrame.get()); |
| 2202 | 2195 |
| 2203 if (childItem) | 2196 if (childItem) |
| 2204 childFrame->loader().loadHistoryItem(childItem); | 2197 childFrame->loader().loadHistoryItem(childItem); |
| 2205 else | 2198 else |
| 2206 childFrame->loader().load(FrameLoadRequest(0, request.resourceRequest(),
"_self")); | 2199 childFrame->loader().load(FrameLoadRequest(0, request.resourceRequest(),
"_self")); |
| 2207 | 2200 |
| 2208 // A synchronous navigation (about:blank) would have already processed | 2201 // A synchronous navigation (about:blank) would have already processed |
| 2209 // onload, so it is possible for the frame to have already been destroyed by | 2202 // onload, so it is possible for the frame to have already been destroyed by |
| 2210 // script in the page. | 2203 // script in the page. |
| 2211 // NOTE: m_client will be null if this frame has been detached. | 2204 // NOTE: m_client will be null if this frame has been detached. |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2516 | 2509 |
| 2517 // There is a possibility that the frame being detached was the only | 2510 // There is a possibility that the frame being detached was the only |
| 2518 // pending one. We need to make sure final replies can be sent. | 2511 // pending one. We need to make sure final replies can be sent. |
| 2519 flushCurrentScopingEffort(m_findRequestIdentifier); | 2512 flushCurrentScopingEffort(m_findRequestIdentifier); |
| 2520 | 2513 |
| 2521 cancelPendingScopingEffort(); | 2514 cancelPendingScopingEffort(); |
| 2522 } | 2515 } |
| 2523 } | 2516 } |
| 2524 | 2517 |
| 2525 } // namespace blink | 2518 } // namespace blink |
| OLD | NEW |