Title: [98311] trunk/Source/WebKit2
Revision
98311
Author
[email protected]
Date
2011-10-24 19:47:22 -0700 (Mon, 24 Oct 2011)

Log Message

Simplify url accessors on WKBrowsingContextController
https://bugs.webkit.org/show_bug.cgi?id=70797

Reviewed by Anders Carlsson.

* UIProcess/API/C/WKPage.cpp:
(WKPageCopyActiveURL):
(WKPageCopyProvisionalURL):
(WKPageCopyCommittedURL):
* UIProcess/API/C/WKPage.h:
Add accessors to C SPI.

* UIProcess/API/mac/WKBrowsingContextController.h:
Remove unreachableURL accessor for now. It may make a glorious return when we have
error page support.

* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController activeURL]):
(-[WKBrowsingContextController provisionalURL]):
(-[WKBrowsingContextController committedURL]):
Implement these in terms of the new C SPI.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::activeURL):
Add computation of the "active" URL, which is the URL one would show
in an address field. It is the pending URL when there is one, the provisional
URL when there is one, and otherwise the committed/final URL.

(WebKit::WebPageProxy::provisionalURL):
(WebKit::WebPageProxy::committedURL):
Add access to the main frame URL.
* UIProcess/WebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98310 => 98311)


--- trunk/Source/WebKit2/ChangeLog	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-25 02:47:22 UTC (rev 98311)
@@ -1,5 +1,40 @@
 2011-10-24  Sam Weinig  <[email protected]>
 
+        Simplify url accessors on WKBrowsingContextController
+        https://bugs.webkit.org/show_bug.cgi?id=70797
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageCopyActiveURL):
+        (WKPageCopyProvisionalURL):
+        (WKPageCopyCommittedURL):
+        * UIProcess/API/C/WKPage.h:
+        Add accessors to C SPI.
+
+        * UIProcess/API/mac/WKBrowsingContextController.h:
+        Remove unreachableURL accessor for now. It may make a glorious return when we have
+        error page support.
+
+        * UIProcess/API/mac/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController activeURL]):
+        (-[WKBrowsingContextController provisionalURL]):
+        (-[WKBrowsingContextController committedURL]):
+        Implement these in terms of the new C SPI.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::activeURL):
+        Add computation of the "active" URL, which is the URL one would show
+        in an address field. It is the pending URL when there is one, the provisional
+        URL when there is one, and otherwise the committed/final URL.
+
+        (WebKit::WebPageProxy::provisionalURL):
+        (WebKit::WebPageProxy::committedURL):
+        Add access to the main frame URL.
+        * UIProcess/WebPageProxy.h:
+
+2011-10-24  Sam Weinig  <[email protected]>
+
         Hook up minimalist load delegate to WKBrowsingContextController
         https://bugs.webkit.org/show_bug.cgi?id=70764
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2011-10-25 02:47:22 UTC (rev 98311)
@@ -506,6 +506,21 @@
     return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL());
 }
 
+WKURLRef WKPageCopyActiveURL(WKPageRef pageRef)
+{
+    return toCopiedURLAPI(toImpl(pageRef)->activeURL());
+}
+
+WKURLRef WKPageCopyProvisionalURL(WKPageRef pageRef)
+{
+    return toCopiedURLAPI(toImpl(pageRef)->provisionalURL());
+}
+
+WKURLRef WKPageCopyCommittedURL(WKPageRef pageRef)
+{
+    return toCopiedURLAPI(toImpl(pageRef)->committedURL());
+}
+
 void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags)
 {
     WebPageProxy::setDebugPaintFlags(flags);

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2011-10-25 02:47:22 UTC (rev 98311)
@@ -323,6 +323,10 @@
 
 WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page);
 
+WK_EXPORT WKURLRef WKPageCopyActiveURL(WKPageRef page);
+WK_EXPORT WKURLRef WKPageCopyProvisionalURL(WKPageRef page);
+WK_EXPORT WKURLRef WKPageCopyCommittedURL(WKPageRef page);
+
 WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page);
 WK_EXPORT WKFrameRef WKPageGetFocusedFrame(WKPageRef page); // The focused frame may be inactive.
 WK_EXPORT WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef page);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h	2011-10-25 02:47:22 UTC (rev 98311)
@@ -83,19 +83,13 @@
 /* URL for the active load. This is the URL that should be shown in user interface. */
 @property(readonly) NSURL *activeURL;
 
-/* URL that has been requested to load by the user, but not yet sent. */
-@property(readonly) NSURL *pendingURL;
-
 /* URL for a request that has been sent, but no response has been recieved yet. */
 @property(readonly) NSURL *provisionalURL;
 
 /* URL for a request that has been recieved, and is now being used. */
-@property(readonly) NSURL *commitedURL;
+@property(readonly) NSURL *committedURL;
 
-/* URL for a request that had an error, whose error page is now showing. */
-@property(readonly) NSURL *unreachableURL;
 
-
 #pragma mark Active Document Introspection
 
 /* Title of the document associated with the active load. */

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2011-10-25 02:47:22 UTC (rev 98311)
@@ -144,31 +144,19 @@
 
 - (NSURL *)activeURL
 {
-    /* FIXME: Implement. */
-    return nil;
+    return autoreleased(WKPageCopyActiveURL(self.pageRef));
 }
 
-- (NSURL *)pendingURL
-{
-    return autoreleased(WKPageCopyPendingAPIRequestURL(self.pageRef));
-}
-
 - (NSURL *)provisionalURL
 {
-    return autoreleased(WKFrameCopyProvisionalURL(WKPageGetMainFrame(self.pageRef)));
+    return autoreleased(WKPageCopyProvisionalURL(self.pageRef));
 }
 
-- (NSURL *)commitedURL
+- (NSURL *)committedURL
 {
-    return autoreleased(WKFrameCopyURL(WKPageGetMainFrame(self.pageRef)));
+    return autoreleased(WKPageCopyCommittedURL(self.pageRef));
 }
 
-- (NSURL *)unreachableURL
-{
-    return autoreleased(WKFrameCopyUnreachableURL(WKPageGetMainFrame(self.pageRef)));
-}
-
-
 #pragma mark Active Document Introspection
 
 - (NSString *)title

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-10-25 02:47:22 UTC (rev 98311)
@@ -593,7 +593,45 @@
     WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
     shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
 }
-    
+
+String WebPageProxy::activeURL() const
+{
+    if (!m_mainFrame)
+        return String();
+
+    // If there is a currently pending url, it is the active URL.
+    if (!m_pendingAPIRequestURL.isNull())
+        return m_pendingAPIRequestURL;
+
+    // FIXME: What do we do in the case of the unreachable URL?
+
+    switch (m_mainFrame->loadState()) {
+    case WebFrameProxy::LoadStateProvisional:
+        return m_mainFrame->provisionalURL();
+    case WebFrameProxy::LoadStateCommitted:
+    case WebFrameProxy::LoadStateFinished:
+        return m_mainFrame->url();
+    }
+
+    ASSERT_NOT_REACHED();
+    return String();
+}
+
+String WebPageProxy::provisionalURL() const
+{
+    if (!m_mainFrame)
+        return String();
+    return m_mainFrame->provisionalURL();
+}
+
+String WebPageProxy::committedURL() const
+{
+    if (!m_mainFrame)
+        return String();
+
+    return m_mainFrame->url();
+}
+
 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
 {
     if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (98310 => 98311)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-10-25 02:38:26 UTC (rev 98310)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-10-25 02:47:22 UTC (rev 98311)
@@ -251,6 +251,10 @@
     void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
     void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem);
 
+    String activeURL() const;
+    String provisionalURL() const;
+    String committedURL() const;
+
     bool willHandleHorizontalScrollEvents() const;
 
     bool canShowMIMEType(const String& mimeType) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to