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