Changeset 16360 in webkit


Ignore:
Timestamp:
Sep 14, 2006 12:20:47 AM (18 years ago)
Author:
beidson
Message:

WebCore:

Reviewed by Maciej

Icon loads now take place in WebCore

  • WebCore.xcodeproj/project.pbxproj:
  • bridge/BrowserExtension.h:
  • bridge/mac/BrowserExtensionMac.h:
  • bridge/mac/BrowserExtensionMac.mm:
  • Moved enforcement of a Mozilla Favicon extension elsewhere


  • bridge/mac/FrameMac.h:
  • bridge/mac/FrameMac.mm: (WebCore::FrameMac::originalRequestURL):
  • Added accessor to "original request URL"


  • bridge/mac/WebCoreFrameBridge.h:
  • Removed methods to set the iconURL as all loading is now done in WebCore
  • Added call throughs to notify WebKit an Icon is done loading, and a to get the original request URL


  • html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process):
  • Moved enforcement of a Mozilla Favicon extension elsewhere


  • loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::setIconURLForPageURL):
  • Changed an ASSERT to correctly handle a sketchy (invalid) situation
  • loader/icon/IconLoader.h: Added.
  • loader/icon/IconLoader.cpp: Added. (IconLoader::IconLoader): (IconLoader::createForFrame):
  • Static factory method with a private constructor to enforce "you MUST have a Frame to create an IconLoader" semantics (IconLoader::~IconLoader): (IconLoader::startLoading): (IconLoader::stopLoading): (IconLoader::receivedData):
  • ResourceLoaderClient delegate (IconLoader::receivedAllData):
  • Ditto
  • loader/mac/IconLoaderMac.mm: Added. (IconLoader::receivedResponse): (IconLoader::notifyIconChanged):
  • For now, these are platform specific methods
  • One to get the HTTP response code of an icon load
  • The other to call through to the app when the icon has changed (loaded)
  • page/Frame.h:
  • page/Frame.cpp: (WebCore::Frame::iconURL): (WebCore::Frame::setIconURL):
  • Frame objects now have an inherent icon URL and a way to calculate/access it (WebCore::Frame::endIfNotLoading):
  • This is where we actually kick off the IconLoader (WebCore::Frame::stop):
  • Added call to stop loading the icon
  • page/FramePrivate.h: (WebCore::FramePrivate::FramePrivate): (WebCore::FramePrivate::~FramePrivate):
  • Added the icon URL as a private member
  • Added the IconLoader as a private member, and clean it up on deletion
  • platform/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::start): Added a valuable ASSERT

WebKit:

Reviewed by Maciej

Add infrastructure to support icon loads taking place in WebCore
Will remove WebKit icon loaders in a later patch

  • WebCoreSupport/WebFrameBridge.m: (-[WebFrameBridge notifyIconChanged:]): (-[WebFrameBridge originalRequestURL]):
  • Nuked two old, obsolete methods
  • Added bridge for notifying of an icon change
  • Added bridge for getting the "original request URL" which is still needed until that info is available in the WebCore loaders
  • WebView/WebDataSource.m: (-[WebDataSource _loadIcon]):
  • Empty body just for now, as it still gets called - next patch will prune all the old impl out
Location:
trunk
Files:
3 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r16359 r16360  
     12006-09-13  Brady Eidson <beidson@apple.com>
     2
     3        Reviewed by Maciej
     4
     5        Icon loads now take place in WebCore
     6
     7        * WebCore.xcodeproj/project.pbxproj:
     8        * bridge/BrowserExtension.h:
     9        * bridge/mac/BrowserExtensionMac.h:
     10        * bridge/mac/BrowserExtensionMac.mm:
     11        - Moved enforcement of a Mozilla Favicon extension elsewhere
     12       
     13        * bridge/mac/FrameMac.h:
     14        * bridge/mac/FrameMac.mm:
     15        (WebCore::FrameMac::originalRequestURL):
     16        - Added accessor to "original request URL"
     17       
     18        * bridge/mac/WebCoreFrameBridge.h:
     19        - Removed methods to set the iconURL as all loading is now done in WebCore
     20        - Added call throughs to notify WebKit an Icon is done loading, and a to get the original request URL
     21       
     22        * html/HTMLLinkElement.cpp:
     23        (WebCore::HTMLLinkElement::process):
     24        - Moved enforcement of a Mozilla Favicon extension elsewhere
     25       
     26        * loader/icon/IconDatabase.cpp:
     27        (WebCore::IconDatabase::setIconURLForPageURL):
     28        - Changed an ASSERT to correctly handle a sketchy (invalid) situation
     29
     30        * loader/icon/IconLoader.h: Added.
     31        * loader/icon/IconLoader.cpp: Added.
     32        (IconLoader::IconLoader):
     33        (IconLoader::createForFrame):
     34        - Static factory method with a private constructor to enforce
     35          "you MUST have a Frame to create an IconLoader" semantics
     36        (IconLoader::~IconLoader):
     37        (IconLoader::startLoading):
     38        (IconLoader::stopLoading):
     39        (IconLoader::receivedData):
     40        - ResourceLoaderClient delegate
     41        (IconLoader::receivedAllData):
     42        - Ditto
     43
     44        * loader/mac/IconLoaderMac.mm: Added.
     45        (IconLoader::receivedResponse):
     46        (IconLoader::notifyIconChanged):
     47        - For now, these are platform specific methods
     48        - One to get the HTTP response code of an icon load
     49        - The other to call through to the app when the icon has changed (loaded)
     50
     51        * page/Frame.h:
     52        * page/Frame.cpp:
     53        (WebCore::Frame::iconURL):
     54        (WebCore::Frame::setIconURL):
     55        - Frame objects now have an inherent icon URL and a way to calculate/access it
     56        (WebCore::Frame::endIfNotLoading):
     57        - This is where we actually kick off the IconLoader
     58        (WebCore::Frame::stop):
     59        - Added call to stop loading the icon
     60
     61        * page/FramePrivate.h:
     62        (WebCore::FramePrivate::FramePrivate):
     63        (WebCore::FramePrivate::~FramePrivate):
     64        - Added the icon URL as a private member
     65        - Added the IconLoader as a private member, and clean it up on deletion
     66
     67        * platform/mac/ResourceLoaderMac.mm:
     68        (WebCore::ResourceLoader::start):  Added a valuable ASSERT
     69
    1702006-09-13  David Hyatt  <hyatt@apple.com>
    271
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r16343 r16360  
    255255                5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */; };
    256256                51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 51386EE60AB4F0D5004AF79E /* IntSizeHash.h */; };
     257                513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
     258                513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
    257259                5186C0560A9C21470034FE94 /* IconDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5186C0550A9C21470034FE94 /* IconDataCache.cpp */; };
     260                51A1D2C60AB69120000D732C /* IconLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A1D2C50AB69120000D732C /* IconLoaderMac.mm */; };
    258261                51D3EA160A3D24D300BADA35 /* SQLDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */; };
    259262                51D3EA170A3D24D300BADA35 /* SQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */; };
     
    27042707                5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreIconDatabaseBridge.mm; sourceTree = "<group>"; };
    27052708                51386EE60AB4F0D5004AF79E /* IntSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntSizeHash.h; sourceTree = "<group>"; };
     2709                513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
     2710                513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
    27062711                5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    27072712                5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    27082713                5186C0550A9C21470034FE94 /* IconDataCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDataCache.cpp; sourceTree = "<group>"; };
     2714                51A1D2C50AB69120000D732C /* IconLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IconLoaderMac.mm; sourceTree = "<group>"; };
    27092715                51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SQLDatabase.cpp; sourceTree = "<group>"; };
    27102716                51D3EA140A3D24D300BADA35 /* SQLDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SQLDatabase.h; sourceTree = "<group>"; };
     
    52985304                                5126E6BA0A2E3B12005C29FA /* IconDatabase.h */,
    52995305                                5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */,
     5306                                513F14520AB634C400094DDF /* IconLoader.h */,
     5307                                513F14510AB634C400094DDF /* IconLoader.cpp */,
    53005308                                51D3EA140A3D24D300BADA35 /* SQLDatabase.h */,
    53015309                                51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */,
     
    60266034                                93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */,
    60276035                                F587850302DE375901EA4122 /* LoaderFunctionsMac.mm */,
     6036                                51A1D2C50AB69120000D732C /* IconLoaderMac.mm */,
    60286037                        );
    60296038                        path = mac;
     
    84168425                                51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */,
    84178426                                06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */,
     8427                                513F14540AB634C400094DDF /* IconLoader.h in Headers */,
    84188428                                066C772B0AB603B700238CC4 /* FileChooser.h in Headers */,
    84198429                                066C77310AB603FD00238CC4 /* RenderFileUploadControl.h in Headers */,
     
    85718581                        isa = PBXProject;
    85728582                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    8573                         compatibilityVersion = "Xcode 2.4";
    85748583                        hasScannedForEncodings = 1;
    85758584                        knownRegions = (
     
    85868595                        projectDirPath = "";
    85878596                        projectRoot = "";
    8588                         shouldCheckCompatibility = 1;
    85898597                        targets = (
    85908598                                93F198A508245E59001E9ABC /* WebCore */,
     
    96239631                                85E9E0A60AB3A0C700069CD0 /* DOMXPathResult.mm in Sources */,
    96249632                                06E81EEC0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm in Sources */,
     9633                                513F14530AB634C400094DDF /* IconLoader.cpp in Sources */,
     9634                                51A1D2C60AB69120000D732C /* IconLoaderMac.mm in Sources */,
    96259635                                066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */,
    96269636                                066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */,
  • trunk/WebCore/bridge/BrowserExtension.h

    r14669 r16360  
    6161    virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*&) = 0;
    6262
    63     virtual void setIconURL(const KURL&) = 0;
    64     virtual void setTypedIconURL(const KURL&, const String& type) = 0;
    65 
    6663    virtual int getHistoryLength() = 0;
    6764    virtual void goBackOrForward(int distance) = 0;
  • trunk/WebCore/bridge/mac/BrowserExtensionMac.h

    r14669 r16360  
    4040                                 Frame*& part);
    4141
    42     virtual void setIconURL(const KURL&);
    43     virtual void setTypedIconURL(const KURL&, const String& type);
    44 
    4542    virtual int getHistoryLength();
    4643    virtual void goBackOrForward(int distance);
  • trunk/WebCore/bridge/mac/BrowserExtensionMac.mm

    r14669 r16360  
    140140}
    141141
    142 void BrowserExtensionMac::setIconURL(const KURL &url)
    143 {
    144     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    145     [m_frame->bridge() setIconURL:url.getNSURL()];
    146     END_BLOCK_OBJC_EXCEPTIONS;
    147 }
    148 
    149 void BrowserExtensionMac::setTypedIconURL(const KURL &url, const String &type)
    150 {
    151     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    152     [m_frame->bridge() setIconURL:url.getNSURL() withType:type];
    153     END_BLOCK_OBJC_EXCEPTIONS;
    154 }
    155 
    156142int BrowserExtensionMac::getHistoryLength()
    157143{
  • trunk/WebCore/bridge/mac/FrameMac.h

    r16353 r16360  
    319319   
    320320    NSEvent* currentEvent() { return _currentEvent; }
    321 
     321    KURL originalRequestURL() const;
     322   
    322323protected:
    323324    virtual void startRedirectionTimer();
  • trunk/WebCore/bridge/mac/FrameMac.mm

    r16329 r16360  
    35643564}
    35653565
    3566 }
     3566KURL FrameMac::originalRequestURL() const
     3567{
     3568    return [_bridge originalRequestURL];
     3569}
     3570
     3571}
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r16245 r16360  
    530530- (void)setStatusText:(NSString *)status;
    531531
    532 - (void)setIconURL:(NSURL *)URL;
    533 - (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
    534 
    535532- (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
    536533    referrer:(NSString *)referrer
     
    693690- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size;
    694691
     692- (void)notifyIconChanged:(NSURL*)iconURL;
     693- (NSURL*)originalRequestURL;
    695694@end
    696695
  • trunk/WebCore/html/HTMLLinkElement.cpp

    r14779 r16360  
    157157
    158158    // IE extension: location of small icon for locationbar / bookmarks
    159     if (frame && m_isIcon && !m_url.isEmpty() && !frame->tree()->parent()) {
    160         if (!type.isEmpty()) // Mozilla extension to IE extension: icon specified with type
    161             frame->browserExtension()->setTypedIconURL(KURL(m_url.deprecatedString()), type);
    162         else
    163             frame->browserExtension()->setIconURL(KURL(m_url.deprecatedString()));
    164     }
     159    if (frame && m_isIcon && !m_url.isEmpty() && !frame->tree()->parent())
     160        frame->setIconURL(m_url, type);
    165161
    166162    // Stylesheet
  • trunk/WebCore/loader/icon/IconDatabase.cpp

    r16295 r16360  
    622622{
    623623    ASSERT(!iconURL.isEmpty());
    624     ASSERT(!pageURL.isEmpty());
     624    if (pageURL.isEmpty())
     625        return false;
    625626   
    626627    // If the urls already map to each other, bail.
  • trunk/WebCore/page/Frame.cpp

    r16322 r16360  
    2828#include "config.h"
    2929#include "Frame.h"
     30#include "FrameMac.h"
    3031#include "FramePrivate.h"
    3132
     
    5455#include "HTMLObjectElement.h"
    5556#include "HTMLViewSourceDocument.h"
     57#include "IconDatabase.h"
     58#include "IconLoader.h"
    5659#include "ImageDocument.h"
    5760#include "MediaFeatureNames.h"
     
    222225    delete d;
    223226    d = 0;
     227}
     228
     229KURL Frame::iconURL()
     230{
     231    // If this isn't a top level frame, return nothing
     232    if (tree() && tree()->parent())
     233        return "";
     234       
     235    // If we have an iconURL from a Link element, return that
     236    if (!d->m_iconURL.isEmpty())
     237        return KURL(d->m_iconURL.deprecatedString());
     238       
     239    // Don't return a favicon iconURL unless we're http or https
     240    if (d->m_url.protocol() != "http" && d->m_url.protocol() != "https")
     241        return "";
     242       
     243    KURL url = d->m_url;
     244    url.setPath("/favicon.ico");
     245    return url;
     246}
     247
     248void Frame::setIconURL(const String& url, const String& type)
     249{
     250    // FIXME - <rdar://problem/4727645> - At some point in the future, we might actually honor the "type"
     251    if (d->m_iconURL.isEmpty())
     252        d->m_iconURL = url;
     253    else if (!type.isEmpty())
     254        d->m_iconURL = url;
    224255}
    225256
     
    715746        // last one to complete.
    716747        checkCompleted();
     748   
     749    // Don't load an icon if -
     750    // 1) This is not the main frame
     751    // 2) The database is disabled
     752    // 3) We have no valid icon URL
     753    // 4) We already have an unexpired icon
     754   
     755    if (tree()->parent())
     756        return;
     757       
     758    // FIXME - <rdar://problem/4729797> - To honor #2, we need to add the isEnabled() flag to WebCore::IconDatabase
     759   
     760    String url(iconURL().url());
     761    if (url.isEmpty())
     762        return;
     763       
     764    IconDatabase* sharedIconDatabase = IconDatabase::sharedIconDatabase();
     765    if (sharedIconDatabase->hasEntryForIconURL(url) && !sharedIconDatabase->isIconExpiredForIconURL(url))
     766        return;
     767   
     768    if (!d->m_iconLoader)
     769        d->m_iconLoader = IconLoader::createForFrame(this);
     770    d->m_iconLoader->startLoading();
    717771}
    718772
     
    729783        // last one to complete.
    730784        checkCompleted();
     785    if (d->m_iconLoader)
     786        d->m_iconLoader->stopLoading();
    731787}
    732788
  • trunk/WebCore/page/Frame.h

    r16353 r16360  
    106106  void didExplicitOpen();
    107107
     108  KURL iconURL();
     109  void setIconURL(const String& url, const String& type);
     110 
    108111  Page* page() const;
    109112  void pageDestroyed();
     
    526529  virtual void urlSelected(const DeprecatedString& url, const String& target);
    527530  virtual void urlSelected(const ResourceRequest&, const String& target);
    528 
    529531
    530532  // Methods with platform-specific overrides (and no base class implementation).
     
    803805
    804806  KURL url() const;
     807 
    805808  void setResourceRequest(const ResourceRequest& request);
    806809  const ResourceRequest& resourceRequest() const;
  • trunk/WebCore/page/FramePrivate.h

    r16250 r16360  
    3535#include "Frame.h"
    3636#include "FrameTree.h"
     37#include "IconLoader.h"
    3738#include "SelectionController.h"
    3839#include "StringHash.h"
     
    4546    class Decoder;
    4647    class UserStyleSheetLoader;
     48    class IconLoader;
    4749
    4850    enum RedirectionScheduled {
     
    9799            , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired)
    98100            , m_userStyleSheetLoader(0)
     101            , m_iconLoader(0)
    99102            , m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired)
    100103            , m_autoscrollLayer(0)
     
    113116            delete m_extension;
    114117            delete m_jscript;
     118            delete m_iconLoader;
    115119        }
    116120
     
    169173
    170174        String m_referrer;
     175
     176        String m_iconURL;
    171177
    172178        struct SubmitForm {
     
    213219
    214220        UserStyleSheetLoader* m_userStyleSheetLoader;
     221        IconLoader* m_iconLoader;
    215222       
    216223        Timer<Frame> m_autoscrollTimer;
  • trunk/WebCore/platform/mac/ResourceLoaderMac.mm

    r16250 r16360  
    5959bool ResourceLoader::start(DocLoader* docLoader)
    6060{
     61    ASSERT(docLoader);
     62   
    6163    FrameMac* frame = Mac(docLoader->frame());
    6264    if (!frame) {
  • trunk/WebKit/ChangeLog

    r16349 r16360  
     12006-09-13  Brady Eidson <beidson@apple.com>
     2
     3        Reviewed by Maciej
     4
     5        Add infrastructure to support icon loads taking place in WebCore
     6        Will remove WebKit icon loaders in a later patch
     7
     8        * WebCoreSupport/WebFrameBridge.m:
     9        (-[WebFrameBridge notifyIconChanged:]):
     10        (-[WebFrameBridge originalRequestURL]):
     11        - Nuked two old, obsolete methods
     12        - Added bridge for notifying of an icon change
     13        - Added bridge for getting the "original request URL" which is still needed
     14          until that info is available in the WebCore loaders
     15
     16        * WebView/WebDataSource.m:
     17        (-[WebDataSource _loadIcon]):
     18        - Empty body just for now, as it still gets called - next patch will prune all the old impl out
     19
    1202006-09-13  Timothy Hatcher  <timothy@apple.com>
    221
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.m

    r15799 r16360  
    4040#import "WebFrameInternal.h"
    4141#import "WebFrameLoadDelegate.h"
     42#import "WebFrameLoader.h"
    4243#import "WebFrameViewInternal.h"
    4344#import "WebHTMLRepresentationPrivate.h"
    4445#import "WebHTMLViewInternal.h"
    4546#import "WebHistoryItemPrivate.h"
     47#import "WebIconDatabase.h"
     48#import <WebKit/WebIconDatabasePrivate.h>
    4649#import "WebJavaPlugIn.h"
    4750#import "WebJavaScriptTextInputPanel.h"
     
    683686    // change its focus-displaying state, but isn't otherwise notified.
    684687    [(WebHTMLView *)[[_frame frameView] documentView] _formControlIsResigningFirstResponder:formControl];
    685 }
    686 
    687 - (void)setIconURL:(NSURL *)URL
    688 {
    689     [[self dataSource] _setIconURL:URL];
    690 }
    691 
    692 - (void)setIconURL:(NSURL *)URL withType:(NSString *)type
    693 {
    694     [[self dataSource] _setIconURL:URL withType:type];
    695688}
    696689
     
    17111704}
    17121705
     1706- (void)notifyIconChanged:(NSURL*)iconURL
     1707{
     1708    ASSERT([[WebIconDatabase sharedIconDatabase] _isEnabled]);
     1709    ASSERT(_frame == [[_frame webView] mainFrame]);
     1710       
     1711    [[_frame webView] _willChangeValueForKey:_WebMainFrameIconKey];
     1712   
     1713    NSImage *icon = [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[_frame _frameLoader] activeDataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
     1714   
     1715    [[[_frame webView] _frameLoadDelegateForwarder] webView:[_frame webView]
     1716                                               didReceiveIcon:icon
     1717                                                     forFrame:_frame];
     1718   
     1719    [[_frame webView] _didChangeValueForKey:_WebMainFrameIconKey];
     1720}
     1721
     1722- (NSURL*)originalRequestURL
     1723{
     1724    return [[[[_frame _frameLoader] activeDataSource] initialRequest] URL];
     1725}
     1726
    17131727@end
  • trunk/WebKit/WebView/WebDataSource.m

    r16271 r16360  
    190190- (void)_loadIcon
    191191{
    192     // Don't load an icon if 1) this is not the main frame 2) we ended in error
    193     // 3) they aren't saved by the DB
    194     if ([self webFrame] != [[self _webView] mainFrame] || _private->mainDocumentError || ![[WebIconDatabase sharedIconDatabase] _isEnabled])
    195         return;
    196 
    197     if (!_private->iconURL) {
    198         // No icon URL from the LINK tag so try the server's root.
    199         // This is only really a feature of http or https, so don't try this with other protocols.
    200         NSString *scheme = [[self _URL] scheme];
    201         if([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]){
    202             _private->iconURL = [[[NSURL _web_URLWithDataAsString:@"/favicon.ico"
    203                                                     relativeToURL:[self _URL]] absoluteURL] retain];
    204         }
    205     }
    206 
    207     if (_private->iconURL != nil) {
    208         // If we have the icon already, we'll still see if we're manually reloading or if the icon is expired
    209         // If so, kick off a reload of the icon
    210         // If we don't have the icon already, kick off the initial load
    211         if ([[WebIconDatabase sharedIconDatabase] _hasEntryForIconURL:[_private->iconURL _web_originalDataAsString]]) {
    212             [[_private->webFrame _frameLoader] _updateIconDatabaseWithURL:_private->iconURL];
    213             if ([[self webFrame] _loadType] == WebFrameLoadTypeReload || [[WebIconDatabase sharedIconDatabase] isIconExpiredForIconURL:[_private->iconURL _web_originalDataAsString]])
    214                 [[WebIconDatabase sharedIconDatabase] loadIconFromURL:[_private->iconURL _web_originalDataAsString]];
    215             else
    216                 [[_private->webFrame _frameLoader] _notifyIconChanged:_private->iconURL];
    217         } else {
    218             NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_private->iconURL];
    219             [[self webFrame] _addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];
    220             [[_private->webFrame _frameLoader] loadIconWithRequest:request];
    221             [request release];
    222         }
    223     }
    224192}
    225193
Note: See TracChangeset for help on using the changeset viewer.