OSDN Git Service

Android History unforking pt2: BackForwardList changes. Fire a notification to the...
authorBen Murdoch <benm@google.com>
Thu, 26 Nov 2009 14:49:53 +0000 (14:49 +0000)
committerBen Murdoch <benm@google.com>
Thu, 3 Dec 2009 11:37:33 +0000 (11:37 +0000)
This needs to be upstreamed to webkit.org.

Change-Id: I14633c51276bd92ed56139b4c473cc8ac9bacb72

15 files changed:
WebCore/history/BackForwardList.cpp
WebCore/loader/EmptyClients.h
WebCore/loader/FrameLoaderClient.h
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
WebKit/wx/WebKitSupport/FrameLoaderClientWx.h

index 99827e3..0aad98b 100644 (file)
 #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;
 }
 
index b4952b1..5fcd4cd 100644 (file)
@@ -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() { }
index a20bd43..7d988f1 100644 (file)
@@ -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.
index d53df88..7286625 100644 (file)
@@ -577,6 +577,18 @@ bool FrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
     return item != 0;
 }
 
+void FrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const
+{
+}
+
+void FrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const
+{
+}
+
+void FrameLoaderClient::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void FrameLoaderClient::didDisplayInsecureContent()
 {
     notImplemented();
index c820135..997ea64 100644 (file)
@@ -135,6 +135,9 @@ namespace WebKit {
         virtual void updateGlobalHistory();
         virtual void updateGlobalHistoryRedirectLinks();
         virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+        virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const;
+        virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const;
+        virtual void dispatchDidChangeBackForwardIndex() const;
 
         virtual void didDisplayInsecureContent();
         virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
index a8ba16f..9ade67b 100644 (file)
@@ -461,6 +461,18 @@ bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const
     return true;
 }
 
+void FrameLoaderClientHaiku::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientHaiku::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientHaiku::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
 {
     notImplemented();
index 33af321..d91320c 100644 (file)
@@ -150,6 +150,9 @@ namespace WebCore {
         virtual void updateGlobalHistory();
         virtual void updateGlobalHistoryRedirectLinks();
         virtual bool shouldGoToHistoryItem(HistoryItem*) const;
+        virtual void dispatchDidAddBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidChangeBackForwardIndex() const;
         virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
         virtual bool canCachePage() const;
 
index 6d365dd..cf6eb0b 100644 (file)
@@ -143,6 +143,9 @@ private:
     virtual void updateGlobalHistoryRedirectLinks();
 
     virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidChangeBackForwardIndex() const;
 
     virtual void didDisplayInsecureContent();
     virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
index bc6c8f4..efd1f68 100644 (file)
@@ -875,6 +875,18 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
     return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:webItem];
 }
 
+void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const
+{
+}
+
+void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const
+{
+}
+
+void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void WebFrameLoaderClient::didDisplayInsecureContent()
 {
     WebView *webView = getWebView(m_webFrame.get());   
index 81ccbe8..8749ada 100644 (file)
@@ -642,6 +642,18 @@ bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *) const
     return true;
 }
 
+void FrameLoaderClientQt::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientQt::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientQt::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void FrameLoaderClientQt::didDisplayInsecureContent()
 {
     notImplemented();
index 66c4252..fe7590d 100644 (file)
@@ -148,7 +148,9 @@ namespace WebCore {
         virtual void updateGlobalHistory();
         virtual void updateGlobalHistoryRedirectLinks();
         virtual bool shouldGoToHistoryItem(HistoryItem*) const;
-
+        virtual void dispatchDidAddBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidChangeBackForwardIndex() const;
         virtual void didDisplayInsecureContent();
         virtual void didRunInsecureContent(SecurityOrigin*);
 
index 2a3bf3c..cb3aed0 100644 (file)
@@ -567,6 +567,18 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
     return true;
 }
 
+void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const
+{
+}
+
+void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const
+{
+}
+
+void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void WebFrameLoaderClient::didDisplayInsecureContent()
 {
     WebView* webView = m_webFrame->webView();
index 921ae91..21599bc 100644 (file)
@@ -91,6 +91,9 @@ public:
     virtual void updateGlobalHistory();
     virtual void updateGlobalHistoryRedirectLinks();
     virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const;
+    virtual void dispatchDidChangeBackForwardIndex() const;
 
     virtual void didDisplayInsecureContent();
     virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
index 9d12ca7..568cf42 100644 (file)
@@ -538,6 +538,18 @@ bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const
     return true;
 }
 
+void FrameLoaderClientWx::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientWx::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientWx::dispatchDidChangeBackForwardIndex() const
+{
+}
+
 void FrameLoaderClientWx::didDisplayInsecureContent()
 {
     notImplemented();
index bfa162f..ed11974 100644 (file)
@@ -147,6 +147,9 @@ namespace WebCore {
         virtual void updateGlobalHistory();
         virtual void updateGlobalHistoryRedirectLinks();
         virtual bool shouldGoToHistoryItem(HistoryItem*) const;
+        virtual void dispatchDidAddBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const;
+        virtual void dispatchDidChangeBackForwardIndex() const;
         virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
         virtual bool canCachePage() const;