diff options
| author | Ben Murdoch <benm@google.com> | 2009-11-26 14:49:53 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2009-12-03 11:37:33 +0000 |
| commit | ed3dcbaa89ede50bb054f63aa1847ae6240fa70d (patch) | |
| tree | dde225bcccabaa57308928d29ecda06ca0c73d64 /WebCore | |
| parent | 5c7b027ae1636ed27f6917385c2b3ec37af33237 (diff) | |
| download | external_webkit-ed3dcbaa89ede50bb054f63aa1847ae6240fa70d.zip external_webkit-ed3dcbaa89ede50bb054f63aa1847ae6240fa70d.tar.gz external_webkit-ed3dcbaa89ede50bb054f63aa1847ae6240fa70d.tar.bz2 | |
Android History unforking pt2: BackForwardList changes. Fire a notification to the FrameLoaderClient that the BackForwardList has been modified.
This needs to be upstreamed to webkit.org.
Change-Id: I14633c51276bd92ed56139b4c473cc8ac9bacb72
Diffstat (limited to 'WebCore')
| -rw-r--r-- | WebCore/history/BackForwardList.cpp | 45 | ||||
| -rw-r--r-- | WebCore/loader/EmptyClients.h | 8 | ||||
| -rw-r--r-- | WebCore/loader/FrameLoaderClient.h | 12 |
3 files changed, 15 insertions, 50 deletions
diff --git a/WebCore/history/BackForwardList.cpp b/WebCore/history/BackForwardList.cpp index 99827e3..0aad98b 100644 --- a/WebCore/history/BackForwardList.cpp +++ b/WebCore/history/BackForwardList.cpp @@ -27,15 +27,13 @@ #include "config.h" #include "BackForwardList.h" -#include "HistoryItem.h" -#include "Logging.h" -#include "PageCache.h" -#ifdef ANDROID_HISTORY_CLIENT #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "HistoryItem.h" +#include "Logging.h" #include "Page.h" -#endif +#include "PageCache.h" using namespace std; @@ -83,45 +81,31 @@ void BackForwardList::addItem(PassRefPtr<HistoryItem> prpItem) m_entryHash.remove(item); pageCache()->remove(item.get()); m_current--; -#ifdef ANDROID_HISTORY_CLIENT - m_page->mainFrame()->loader()->client()->dispatchDidRemoveHistoryItem(item.get(), 0); -#endif + m_page->mainFrame()->loader()->client()->dispatchDidRemoveBackForwardItem(item.get()); } m_entries.append(prpItem); m_entryHash.add(m_entries.last()); m_current++; -#ifdef ANDROID_HISTORY_CLIENT - m_page->mainFrame()->loader()->client()->dispatchDidAddHistoryItem(currentItem()); -#endif + m_page->mainFrame()->loader()->client()->dispatchDidAddBackForwardItem(currentItem()); } void BackForwardList::goBack() { ASSERT(m_current > 0); -#ifdef ANDROID_HISTORY_CLIENT if (m_current > 0) { m_current--; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (m_current > 0) - m_current--; -#endif } void BackForwardList::goForward() { ASSERT(m_current < m_entries.size() - 1); -#ifdef ANDROID_HISTORY_CLIENT if (m_current < m_entries.size() - 1) { m_current++; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (m_current < m_entries.size() - 1) - m_current++; -#endif } void BackForwardList::goToItem(HistoryItem* item) @@ -133,15 +117,10 @@ void BackForwardList::goToItem(HistoryItem* item) for (; index < m_entries.size(); ++index) if (m_entries[index] == item) break; -#ifdef ANDROID_HISTORY_CLIENT if (index < m_entries.size()) { m_current = index; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - if (index < m_entries.size()) - m_current = index; -#endif } HistoryItem* BackForwardList::backItem() @@ -207,16 +186,10 @@ void BackForwardList::setCapacity(int size) if (!size) m_current = NoCurrentItemIndex; -#ifdef ANDROID_HISTORY_CLIENT else if (m_current > m_entries.size() - 1) { m_current = m_entries.size() - 1; - m_page->mainFrame()->loader()->client()->dispatchDidChangeHistoryIndex(this); + m_page->mainFrame()->loader()->client()->dispatchDidChangeBackForwardIndex(); } -#else - else if (m_current > m_entries.size() - 1) - m_current = m_entries.size() - 1; -#endif - m_capacity = size; } diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index b4952b1..5fcd4cd 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -283,11 +283,9 @@ public: virtual void updateGlobalHistory() { } virtual void updateGlobalHistoryRedirectLinks() { } virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; } -#ifdef ANDROID_HISTORY_CLIENT - virtual void dispatchDidAddHistoryItem(HistoryItem*) const {} - virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const {} - virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const {} -#endif + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const { } + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { } + virtual void dispatchDidChangeBackForwardIndex() const { } virtual void saveViewStateToItem(HistoryItem*) { } virtual bool canCachePage() const { return false; } virtual void didDisplayInsecureContent() { } diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index a20bd43..7d988f1 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -73,10 +73,6 @@ namespace WebCore { class String; class Widget; -#ifdef ANDROID_HISTORY_CLIENT - class BackForwardList; -#endif - typedef void (PolicyChecker::*FramePolicyFunction)(PolicyAction); class FrameLoaderClient { @@ -169,11 +165,9 @@ namespace WebCore { virtual void updateGlobalHistoryRedirectLinks() = 0; virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0; -#ifdef ANDROID_HISTORY_CLIENT - virtual void dispatchDidAddHistoryItem(HistoryItem*) const = 0; - virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const = 0; - virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const = 0; -#endif + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidChangeBackForwardIndex() const = 0; // This frame has displayed inactive content (such as an image) from an // insecure source. Inactive content cannot spread to other frames. |
