2011-05-13 Tao Bai <michaelbai@chromium.org>

        Reviewed by Darin Fisher.

        Handle the touch icon.
        https://bugs.webkit.org/show_bug.cgi?id=60247

        Added WebIconURL for the corresponding IconURL.
        Added method iconURLs() to specify the type of icon need to return.
        The favIconURL() is deprecated and will be removed later.

        * WebKit.gyp:
        * features.gypi:
        * public/WebFrame.h:
        * public/WebFrameClient.h:
        (WebKit::WebFrameClient::didChangeIcons):
        * public/WebIconURL.h: Added.
        (WebKit::WebIconURL::WebIconURL):
        (WebKit::WebIconURL::iconType):
        (WebKit::WebIconURL::iconURL):
        * src/AssertMatchingEnums.cpp:
        * src/FrameLoaderClientImpl.cpp:
        (WebKit::FrameLoaderClientImpl::dispatchDidChangeIcons):
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrameImpl::favIconURL):
        * src/WebFrameImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c5b2001d
2011-05-13 Tao Bai <michaelbai@chromium.org>
Reviewed by Darin Fisher.
Handle the touch icon.
https://bugs.webkit.org/show_bug.cgi?id=60247
Added WebIconURL for the corresponding IconURL.
Added method iconURLs() to specify the type of icon need to return.
The favIconURL() is deprecated and will be removed later.
* WebKit.gyp:
* features.gypi:
* public/WebFrame.h:
* public/WebFrameClient.h:
(WebKit::WebFrameClient::didChangeIcons):
* public/WebIconURL.h: Added.
(WebKit::WebIconURL::WebIconURL):
(WebKit::WebIconURL::iconType):
(WebKit::WebIconURL::iconURL):
* src/AssertMatchingEnums.cpp:
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::dispatchDidChangeIcons):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::favIconURL):
* src/WebFrameImpl.h:
2011-05-13 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
......@@ -264,8 +291,8 @@
https://bugs.webkit.org/show_bug.cgi?id=60247
Added WebIconURL for the corresponding IconURL.
Added a parameter to favIconURL() to specify the type of icon need to
return.
Added method iconURLs() to specify the type of icon need to return.
The favIconURL() is deprecated.
* WebKit.gyp:
* features.gypi:
......
......@@ -185,6 +185,7 @@
'public/WebHTTPBody.h',
'public/WebHTTPLoadInfo.h',
'public/WebIconLoadingCompletion.h',
'public/WebIconURL.h',
'public/WebImage.h',
'public/WebImageDecoder.h',
'public/WebIDBCallbacks.h',
......
......@@ -88,6 +88,7 @@
'ENABLE_SVG_FOREIGN_OBJECT=1',
'ENABLE_SVG_USE=1',
'ENABLE_TOUCH_EVENTS=1',
'ENABLE_TOUCH_ICON_LOADING=1',
'ENABLE_V8_SCRIPT_DEBUG_SERVER=1',
'ENABLE_VIDEO=1',
'ENABLE_WEB_AUDIO=0',
......
......@@ -33,8 +33,11 @@
#include "WebCanvas.h"
#include "WebFileSystem.h"
#include "WebIconURL.h"
#include "WebNode.h"
#include "WebURL.h"
// FIXME : Remove this file when transient done.
#include "WebVector.h"
struct NPObject;
......@@ -129,10 +132,20 @@ public:
// dataSource()->request().url().
virtual WebURL url() const = 0;
// The url of the favicon (if any) specified by the document loaded in
// this frame.
// DEPRECATED: Use iconIRLs instead.
virtual WebURL favIconURL() const = 0;
// The urls of the given combination types of favicon (if any) specified by
// the document loaded in this frame. The iconTypes is a bit-mask of
// WebIconURL::Type values, used to select from the available set of icon
// URLs
virtual WebVector<WebIconURL> iconURLs(int iconTypes) const
{
// FIXME : Remove the implementation, this make buildbot happy during
// the transient.
return WebVector<WebIconURL>();
}
// The url of the OpenSearch Desription Document (if any) specified by
// the document loaded in this frame.
virtual WebURL openSearchDescriptionURL() const = 0;
......
......@@ -33,6 +33,7 @@
#include "WebCommon.h"
#include "WebFileSystem.h"
#include "WebIconURL.h"
#include "WebNavigationPolicy.h"
#include "WebNavigationType.h"
#include "WebStorageQuotaType.h"
......@@ -201,9 +202,12 @@ public:
didReceiveTitle(frame, title);
}
// The icons for the page have changed.
// DEPRECATED: Implement didChangeIcon instead.
virtual void didChangeIcons(WebFrame*) { }
// The icon for the page have changed.
virtual void didChangeIcon(WebFrame*, WebIconURL::Type) { }
// The frame's document finished loading.
virtual void didFinishDocumentLoad(WebFrame*) { }
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebIconURL_h
#define WebIconURL_h
#if WEBKIT_IMPLEMENTATION
#include "IconURL.h"
#endif
#include "WebURL.h"
namespace WebKit {
class WebIconURL {
public:
enum Type {
TypeInvalid = 0,
TypeFavicon = 1 << 0,
TypeTouch = 1 << 1,
TypeTouchPrecomposed = 1 << 2
};
WebIconURL()
: m_iconType(TypeInvalid)
{
}
WebIconURL(const WebURL& url, Type type)
: m_iconType(type)
, m_iconURL(url)
{
}
Type iconType() const
{
return m_iconType;
}
const WebURL& iconURL() const
{
return m_iconURL;
}
#if WEBKIT_IMPLEMENTATION
WebIconURL(const WebCore::IconURL& iconURL)
: m_iconType(static_cast<Type>(iconURL.m_iconType))
, m_iconURL(iconURL.m_iconURL)
{
}
#endif
private:
Type m_iconType;
WebURL m_iconURL;
};
}
#endif // WebIconURL_h
......@@ -46,6 +46,7 @@
#include "GeolocationError.h"
#include "GeolocationPosition.h"
#include "HTMLInputElement.h"
#include "IconURL.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBKey.h"
#include "MediaPlayer.h"
......@@ -73,6 +74,7 @@
#include "WebGeolocationPosition.h"
#include "WebIDBFactory.h"
#include "WebIDBKey.h"
#include "WebIconURL.h"
#include "WebInputElement.h"
#include "WebMediaPlayer.h"
#include "WebNotificationPresenter.h"
......@@ -304,6 +306,11 @@ COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight900, FontWeight900);
COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightNormal, FontWeightNormal);
COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightBold, FontWeightBold);
COMPILE_ASSERT_MATCHING_ENUM(WebIconURL::TypeInvalid, InvalidIcon);
COMPILE_ASSERT_MATCHING_ENUM(WebIconURL::TypeFavicon, Favicon);
COMPILE_ASSERT_MATCHING_ENUM(WebIconURL::TypeTouch, TouchIcon);
COMPILE_ASSERT_MATCHING_ENUM(WebIconURL::TypeTouchPrecomposed, TouchPrecomposedIcon);
COMPILE_ASSERT_MATCHING_ENUM(WebNode::ElementNode, Node::ELEMENT_NODE);
COMPILE_ASSERT_MATCHING_ENUM(WebNode::AttributeNode, Node::ATTRIBUTE_NODE);
COMPILE_ASSERT_MATCHING_ENUM(WebNode::TextNode, Node::TEXT_NODE);
......
......@@ -759,8 +759,12 @@ void FrameLoaderClientImpl::dispatchDidReceiveTitle(const StringWithDirection& t
void FrameLoaderClientImpl::dispatchDidChangeIcons(WebCore::IconType type)
{
if (m_webFrame->client())
m_webFrame->client()->didChangeIcons(m_webFrame);
if (m_webFrame->client()) {
m_webFrame->client()->didChangeIcon(m_webFrame, static_cast<WebIconURL::Type>(type));
// FIXME : Keep the API work in the transient.
if (type == WebCore::Favicon)
m_webFrame->client()->didChangeIcons(m_webFrame);
}
}
void FrameLoaderClientImpl::dispatchDidCommitLoad()
......
......@@ -101,6 +101,7 @@
#include "HTMLNames.h"
#include "HistoryItem.h"
#include "HitTestResult.h"
#include "IconURL.h"
#include "InspectorController.h"
#include "Page.h"
#include "painting/GraphicsContextBuilder.h"
......@@ -137,6 +138,7 @@
#include "WebFormElement.h"
#include "WebFrameClient.h"
#include "WebHistoryItem.h"
#include "WebIconURL.h"
#include "WebInputElement.h"
#include "WebNode.h"
#include "WebPasswordAutocompleteListener.h"
......@@ -520,17 +522,22 @@ WebURL WebFrameImpl::url() const
WebURL WebFrameImpl::favIconURL() const
{
FrameLoader* frameLoader = m_frame->loader();
// The URL to the favicon may be in the header. As such, only
// ask the loader for the favicon if it's finished loading.
if (frameLoader->state() == FrameStateComplete) {
const KURL& url = frameLoader->iconURL();
if (!url.isEmpty())
return url;
}
WebVector<WebIconURL> urls = iconURLs(WebIconURL::TypeFavicon);
if (urls.size())
return urls[0].iconURL();
return WebURL();
}
WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypes) const
{
FrameLoader* frameLoader = m_frame->loader();
// The URL to the icon may be in the header. As such, only
// ask the loader for the icon if it's finished loading.
if (frameLoader->state() == FrameStateComplete)
return frameLoader->iconURLs(iconTypes);
return WebVector<WebIconURL>();
}
WebURL WebFrameImpl::openSearchDescriptionURL() const
{
FrameLoader* frameLoader = m_frame->loader();
......
......@@ -71,6 +71,7 @@ public:
virtual long long identifier() const;
virtual WebURL url() const;
virtual WebURL favIconURL() const;
virtual WebVector<WebIconURL> iconURLs(int iconTypes) const;
virtual WebURL openSearchDescriptionURL() const;
virtual WebString encoding() const;
virtual WebSize scrollOffset() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment