+2006-11-10 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin
+
+ Took out WebIconDatabaseBridge and made WebKit call IconDatabase directly
+
+ * WebCore.exp:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bridge/mac/WebCoreIconDatabaseBridge.h: Removed.
+ * bridge/mac/WebCoreIconDatabaseBridge.mm: Removed.
+ * loader/FrameLoaderClient.h:
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::sharedIconDatabase):
+ (WebCore::IconDatabase::~IconDatabase):
+ * loader/icon/IconDatabase.h:
+ (WebCore::IconDatabase::isPrivateBrowsingEnabled):
+ (WebCore::IconDatabase::enabled):
+ * loader/icon/IconLoader.cpp:
+ (WebCore::IconLoader::finishLoading):
+ * loader/mac/FrameLoaderMac.mm:
+
2006-11-10 Zack Rusin <zack@kde.org>
Reviewed and landed by Anders.
.objc_class_name_WebCoreEncodings
.objc_class_name_WebCoreFrameBridge
.objc_class_name_WebCoreHistory
-.objc_class_name_WebCoreIconDatabaseBridge
.objc_class_name_WebCoreJavaScript
.objc_class_name_WebCoreKeyGenerator
.objc_class_name_WebCorePageState
__ZN7WebCore11selectRangeEPNS_19SelectionControllerEPNS_5RangeENS_9EAffinityEb
__ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindow
__ZN7WebCore12AtomicString3addEPNS_10StringImplE
+__ZN7WebCore12IconDatabase10setEnabledEb
+__ZN7WebCore12IconDatabase10setEnabledEb
+__ZN7WebCore12IconDatabase11defaultIconERKNS_7IntSizeE
+__ZN7WebCore12IconDatabase14iconForPageURLERKNS_6StringERKNS_7IntSizeEb
+__ZN7WebCore12IconDatabase14removeAllIconsEv
+__ZN7WebCore12IconDatabase17iconURLForPageURLERKNS_6StringE
+__ZN7WebCore12IconDatabase18hasEntryForIconURLERKNS_6StringE
+__ZN7WebCore12IconDatabase18sharedIconDatabaseEv
+__ZN7WebCore12IconDatabase18sharedIconDatabaseEv
+__ZN7WebCore12IconDatabase20retainIconForPageURLERKNS_6StringE
+__ZN7WebCore12IconDatabase20setIconURLForPageURLERKNS_6StringES3_
+__ZN7WebCore12IconDatabase21releaseIconForPageURLERKNS_6StringE
+__ZN7WebCore12IconDatabase21setIconDataForIconURLEPKviRKNS_6StringE
+__ZN7WebCore12IconDatabase23defaultDatabaseFilenameEv
+__ZN7WebCore12IconDatabase23isIconExpiredForIconURLERKNS_6StringE
+__ZN7WebCore12IconDatabase23setHaveNoIconForIconURLERKNS_6StringE
+__ZN7WebCore12IconDatabase25setPrivateBrowsingEnabledEb
+__ZN7WebCore12IconDatabase4openERKNS_6StringE
+__ZN7WebCore12IconDatabase5closeEv
+__ZN7WebCore12IconDatabase7isEmptyEv
__ZN7WebCore12nsURLRequestERKNS_15ResourceRequestE
__ZN7WebCore13HitTestResultC1ERKNS_8IntPointE
__ZN7WebCore13HitTestResultC1ERKS0_
__ZN7WebCore6StringC1EP8NSString
__ZN7WebCore6StringC1EPKc
__ZN7WebCore6StringC1ERKNS_16DeprecatedStringE
+__ZN7WebCore7IntSizeC1ERK7_NSSize
__ZN7WebCore7nsColorERKNS_5ColorE
__ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
__ZN7WebCore8Document12setFocusNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
__ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
__ZNK7WebCore11FrameLoader27numPendingOrLoadingRequestsEb
+__ZNK7WebCore11FrameLoader3urlEv
__ZNK7WebCore11FrameLoader6clientEv
__ZNK7WebCore11FrameLoader8loadTypeEv
__ZNK7WebCore11FrameLoader8referrerEv
5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5115095B0A9CE04600901013 /* urlIcon.tiff */; };
5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 5126E6BF0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */; };
51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 51386EE60AB4F0D5004AF79E /* IntSizeHash.h */; };
513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
5186C0560A9C21470034FE94 /* IconDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5186C0550A9C21470034FE94 /* IconDataCache.cpp */; };
51D3EA160A3D24D300BADA35 /* SQLDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */; };
- 51D3EA170A3D24D300BADA35 /* SQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */; };
+ 51D3EA170A3D24D300BADA35 /* SQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
51D3EA180A3D24D300BADA35 /* SQLStatement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D3EA150A3D24D300BADA35 /* SQLStatement.cpp */; };
51F11E150A48C2920034A24E /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F11E140A48C2920034A24E /* SQLTransaction.cpp */; };
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
5115095B0A9CE04600901013 /* urlIcon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = urlIcon.tiff; sourceTree = "<group>"; };
5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
- 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreIconDatabaseBridge.h; sourceTree = "<group>"; };
- 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreIconDatabaseBridge.mm; sourceTree = "<group>"; };
51386EE60AB4F0D5004AF79E /* IntSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntSizeHash.h; sourceTree = "<group>"; };
513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
654EC60F097778F500DAB52C /* WebCoreFrameBridge.h */,
654EC610097778F500DAB52C /* WebCoreFrameBridge.mm */,
F587854C02DE375901EA4122 /* WebCoreFrameView.h */,
- 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */,
- 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */,
F5B2A52B02E22573018635CB /* WebCoreJavaScript.h */,
F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */,
BE983D95052A2E0A00892D85 /* WebCoreKeyboardAccess.h */,
DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
A833C80D0A2CF25600D57664 /* XMLNames.h in Headers */,
5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */,
- 5126E6BF0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h in Headers */,
D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */,
4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */,
A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */,
A833C8520A2CF52800D57664 /* SVGElementFactory.cpp in Sources */,
5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */,
- 5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */,
D07DEAB90A36554A00CA30F8 /* InsertListCommand.cpp in Sources */,
4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */,
4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */,
+++ /dev/null
-/*
- * Copyright (C) 2006 Apple Computer, 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:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
- */
-
-#ifdef __cplusplus
-namespace WebCore {
- class IconDatabase;
-}
-typedef WebCore::IconDatabase WebCoreIconDatabase;
-#else
-@class WebCoreIconDatabase;
-#endif
-
-@interface WebCoreIconDatabaseBridge : NSObject
-{
-}
-+ (WebCoreIconDatabaseBridge *)sharedInstance;
-
-- (BOOL)openSharedDatabaseWithPath:(NSString *)path;
-- (void)closeSharedDatabase;
-- (BOOL)isOpen;
-- (void)removeAllIcons;
-
-- (NSImage *)iconForPageURL:(NSString *)url withSize:(NSSize)size;
-- (NSString *)iconURLForPageURL:(NSString *)url;
-- (NSImage *)defaultIconWithSize:(NSSize)size;
-- (void)retainIconForURL:(NSString *)url;
-- (void)releaseIconForURL:(NSString *)url;
-
-- (BOOL)isIconExpiredForIconURL:(NSString *)iconURL;
-
-- (void)setPrivateBrowsingEnabled:(BOOL)flag;
-- (BOOL)privateBrowsingEnabled;
-
-- (NSString *)defaultDatabaseFilename;
-
-- (void)_setIconData:(NSData *)data forIconURL:(NSString *)iconURL;
-- (void)_setHaveNoIconForIconURL:(NSString *)iconURL;
-- (BOOL)_setIconURL:(NSString *)iconURL forPageURL:(NSString *)pageURL;
-- (BOOL)_hasEntryForIconURL:(NSString *)iconURL;
-
-- (BOOL)_isEmpty;
-- (void)_setEnabled:(BOOL)enabled;
-- (BOOL)_isEnabled;
-@end
-
-// The WebCoreIconDatabaseBridge protocol contains methods for use by the WebCore side of the bridge.
-
-@protocol WebCoreIconDatabaseBridge
-+ (WebCoreIconDatabaseBridge *)createInstance;
-@end
-
-// This interface definition allows those who hold a WebCoreIconDatabaseBridge * to call all the methods
-// in the WebCoreIconDatabaseBridge protocol without requiring the base implementation to supply the methods.
-// This idiom is appropriate because WebCoreIconDatabaseBridge is an abstract class.
-
-@interface WebCoreIconDatabaseBridge (SubclassResponsibility) <WebCoreIconDatabaseBridge>
-@end
+++ /dev/null
-/*
- * Copyright (C) 2006 Apple Computer, 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:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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.
- */
-
-#import "config.h"
-#import "WebCoreIconDatabaseBridge.h"
-
-#import "IconDatabase.h"
-#import "Image.h"
-#import "Logging.h"
-#import "PlatformString.h"
-#import "RetainPtr.h"
-
-using namespace WebCore;
-
-@implementation WebCoreIconDatabaseBridge
-
-- (BOOL)openSharedDatabaseWithPath:(NSString *)path
-{
- ASSERT(path);
-
- IconDatabase* iconDB = IconDatabase::sharedIconDatabase();
-
- iconDB->open((String([path stringByStandardizingPath])));
- if (!iconDB->isOpen()) {
- [self closeSharedDatabase];
- NSLog(@"Unable to open icon database at %@ - Check your write permissions at that path. Icon database will be disabled for this browsing session", path);
- return NO;
- }
- return YES;
-}
-
-- (void)closeSharedDatabase
-{
- IconDatabase::sharedIconDatabase()->close();
-}
-
-- (BOOL)isOpen
-{
- return IconDatabase::sharedIconDatabase()->isOpen();
-}
-
-- (void)removeAllIcons
-{
- IconDatabase::sharedIconDatabase()->removeAllIcons();
-}
-
-- (BOOL)_isEmpty
-{
- return IconDatabase::sharedIconDatabase()->isEmpty();
-}
-
-- (BOOL)isIconExpiredForIconURL:(NSString *)iconURL
-{
- return IconDatabase::sharedIconDatabase()->isIconExpiredForIconURL(iconURL);
-}
-
-- (void)setPrivateBrowsingEnabled:(BOOL)flag
-{
- IconDatabase::sharedIconDatabase()->setPrivateBrowsingEnabled(flag);
-}
-
-- (BOOL)privateBrowsingEnabled
-{
- return IconDatabase::sharedIconDatabase()->getPrivateBrowsingEnabled();
-}
-
-- (NSImage *)iconForPageURL:(NSString *)url withSize:(NSSize)size
-{
- ASSERT(url);
- ASSERT(size.width);
- ASSERT(size.height);
-
- // FIXME - We're doing the resize here for now because WebCore::Image doesn't yet support resizing/multiple representations
- // This makes it so there's effectively only one size of a particular icon in the system at a time. We really need to move this
- // to WebCore::Image and WebCore::IconDatabase asap
- Image* image = IconDatabase::sharedIconDatabase()->iconForPageURL(String(url), IntSize(size));
- if (image) {
- NSImage* nsImage = image->getNSImage();
- if (!nsImage) {
- LOG(IconDatabase, "image didn't return a valid NSImage for URL %@", url);
- return nil;
- }
- LOG(IconDatabase, "Found %i representations in the NSImage", [[nsImage representations] count]);
-
- if (!NSEqualSizes([nsImage size], size)) {
- [nsImage setScalesWhenResized:YES];
- [nsImage setSize:size];
- }
- return nsImage;
- }
- return nil;
-}
-
-- (NSString *)iconURLForPageURL:(NSString *)url
-{
- ASSERT(url);
-
- String iconURL = IconDatabase::sharedIconDatabase()->iconURLForPageURL(String(url));
- return (NSString*)iconURL;
-}
-
-- (NSImage *)defaultIconWithSize:(NSSize)size
-{
- ASSERT(size.width);
- ASSERT(size.height);
-
- Image* image = IconDatabase::sharedIconDatabase()->defaultIcon(IntSize(size));
- if (image)
- return image->getNSImage();
- return nil;
-}
-
-- (void)retainIconForURL:(NSString *)url
-{
- ASSERT(url);
-
- IconDatabase::sharedIconDatabase()->retainIconForPageURL(String(url));
-}
-
-- (void)releaseIconForURL:(NSString *)url
-{
- ASSERT(url);
-
- IconDatabase::sharedIconDatabase()->releaseIconForPageURL(String(url));
-}
-
-- (void)_setIconData:(NSData *)data forIconURL:(NSString *)iconURL
-{
- ASSERT(data);
- ASSERT(iconURL);
-
- IconDatabase::sharedIconDatabase()->setIconDataForIconURL([data bytes], [data length], String(iconURL));
-}
-
-- (void)_setHaveNoIconForIconURL:(NSString *)iconURL
-{
- ASSERT(iconURL);
-
- IconDatabase::sharedIconDatabase()->setHaveNoIconForIconURL(String(iconURL));
-}
-
-- (BOOL)_setIconURL:(NSString *)iconURL forPageURL:(NSString *)pageURL
-{
- ASSERT(iconURL);
- ASSERT(pageURL);
-
- return IconDatabase::sharedIconDatabase()->setIconURLForPageURL(String(iconURL), String(pageURL));
-}
-
-- (BOOL)_hasEntryForIconURL:(NSString *)iconURL
-{
- return IconDatabase::sharedIconDatabase()->hasEntryForIconURL(iconURL);
-}
-
-- (NSString *)defaultDatabaseFilename
-{
- return IconDatabase::defaultDatabaseFilename();
-}
-
-- (void)_setEnabled:(BOOL)enabled
-{
- IconDatabase::sharedIconDatabase()->setEnabled(enabled);
-}
-
-- (BOOL)_isEnabled
-{
- return IconDatabase::sharedIconDatabase()->enabled();
-}
-
-+ (WebCoreIconDatabaseBridge *)sharedInstance
-{
- static RetainPtr<WebCoreIconDatabaseBridge> bridge;
- if (!bridge)
- bridge = [self createInstance];
- return bridge.get();
-}
-
-@end
virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) = 0;
virtual void dispatchDidChangeLocationWithinPage() = 0;
virtual void dispatchWillClose() = 0;
-#if PLATFORM(MAC)
- virtual void dispatchDidReceiveIcon(NSImage *) = 0;
-#endif
+ virtual void dispatchDidReceiveIcon() = 0;
virtual void dispatchDidStartProvisionalLoad() = 0;
virtual void dispatchDidReceiveTitle(const String& title) = 0;
virtual void dispatchDidCommitLoad() = 0;
#include "IconDataCache.h"
#include "Image.h"
#include "Logging.h"
-#include "PlatformString.h"
#include "SQLStatement.h"
#include "SQLTransaction.h"
#include "SystemTime.h"
namespace WebCore {
-IconDatabase* IconDatabase::m_sharedInstance = 0;
+static IconDatabase* sharedInstance = 0;
// This version number is in the DB and marks the current generation of the schema
// Theoretically once the switch is flipped this should never change
// Currently, an out-of-date schema causes the DB to be wiped and reset. This isn't
// so bad during development but in the future, we would need to write a conversion
// function to advance older released schemas to "current"
-const int IconDatabase::currentDatabaseVersion = 5;
+const int currentDatabaseVersion = 5;
// Icons expire once a day
-const int IconDatabase::iconExpirationTime = 60*60*24;
+const int iconExpirationTime = 60*60*24;
// Absent icons are rechecked once a week
-const int IconDatabase::missingIconExpirationTime = 60*60*24*7;
+const int missingIconExpirationTime = 60*60*24*7;
-const int IconDatabase::updateTimerDelay = 5;
+const int updateTimerDelay = 5;
const String& IconDatabase::defaultDatabaseFilename()
{
IconDatabase* IconDatabase::sharedIconDatabase()
{
- if (!m_sharedInstance)
- m_sharedInstance = new IconDatabase();
-
- return m_sharedInstance;
+ if (!sharedInstance)
+ sharedInstance = new IconDatabase;
+ return sharedInstance;
}
IconDatabase::IconDatabase()
close();
m_startupTimer.stop();
m_updateTimer.stop();
- if (m_sharedInstance == this)
- m_sharedInstance = 0;
+ if (sharedInstance == this)
+ sharedInstance = 0;
}
// readySQLStatement() handles two things
return result == SQLResultRow;
}
-} //namespace WebCore
+} // namespace WebCore
#ifndef ICONDATABASE_H
#define ICONDATABASE_H
-#include "config.h"
-
-#include "IntSize.h"
-#include "IntSizeHash.h"
-#include "PlatformString.h"
#include "SQLDatabase.h"
#include "StringHash.h"
#include "Timer.h"
-
-
+#include <wtf/Noncopyable.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
namespace WebCore {
class Image;
+class IntSize;
class IconDataCache;
class SQLTransaction;
-class SQLStatement;
-class IconDatabase
-{
+class IconDatabase : Noncopyable {
public:
static IconDatabase* sharedIconDatabase();
- ~IconDatabase();
bool open(const String& path);
bool isOpen() { return m_mainDB.isOpen() && m_privateBrowsingDB.isOpen(); }
void releaseIconForPageURL(const String&);
void setPrivateBrowsingEnabled(bool flag);
- bool getPrivateBrowsingEnabled() { return m_privateBrowsingEnabled; }
+ bool isPrivateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
bool hasEntryForIconURL(const String&);
bool setIconURLForPageURL(const String& iconURL, const String& pageURL);
void setEnabled(bool enabled);
- bool enabled() { return m_isEnabled; }
+ bool enabled() const { return m_isEnabled; }
static const String& defaultDatabaseFilename();
- static const int currentDatabaseVersion;
- static const int iconExpirationTime;
- static const int missingIconExpirationTime;
- static const int updateTimerDelay;
private:
IconDatabase();
-
+ ~IconDatabase();
+
// This tries to get the iconID for the IconURL and, if it doesn't exist and createIfNecessary is true,
// it will create the entry and return the new iconID
int64_t establishIconIDForIconURL(SQLDatabase&, const String&, bool createIfNecessary = true);
// Query - Returns the time stamp for an Icon entry
int timeStampForIconURLQuery(SQLDatabase&, const String& iconURL);
- SQLStatement *m_timeStampForIconURLStatement;
+ SQLStatement* m_timeStampForIconURLStatement;
// Query - Returns the IconURL for a PageURL
String iconURLForPageURLQuery(SQLDatabase&, const String& pageURL);
- SQLStatement *m_iconURLForPageURLStatement;
+ SQLStatement* m_iconURLForPageURLStatement;
// Query - Checks for the existence of the given IconURL in the Icon table
bool hasIconForIconURLQuery(SQLDatabase& db, const String& iconURL);
- SQLStatement *m_hasIconForIconURLStatement;
+ SQLStatement* m_hasIconForIconURLStatement;
// Query - Deletes a PageURL from the PageURL table
void forgetPageURLQuery(SQLDatabase& db, const String& pageURL);
- SQLStatement *m_forgetPageURLStatement;
+ SQLStatement* m_forgetPageURLStatement;
// Query - Sets the Icon.iconID for a PageURL in the PageURL table
void setIconIDForPageURLQuery(SQLDatabase& db, int64_t, const String&);
- SQLStatement *m_setIconIDForPageURLStatement;
+ SQLStatement* m_setIconIDForPageURLStatement;
// Query - Returns the iconID for the given IconURL
int64_t getIconIDForIconURLQuery(SQLDatabase& db, const String& iconURL);
- SQLStatement *m_getIconIDForIconURLStatement;
+ SQLStatement* m_getIconIDForIconURLStatement;
// Query - Creates the Icon entry for the given IconURL and returns the resulting iconID
int64_t addIconForIconURLQuery(SQLDatabase& db, const String& iconURL);
- SQLStatement *m_addIconForIconURLStatement;
+ SQLStatement* m_addIconForIconURLStatement;
// Query - Returns the image data from the given database for the given IconURL
void imageDataForIconURLQuery(SQLDatabase& db, const String& iconURL, Vector<unsigned char>& result);
- SQLStatement *m_imageDataForIconURLStatement;
+ SQLStatement* m_imageDataForIconURLStatement;
void deleteAllPreparedStatements(bool withSync);
- // FIXME: This method is currently implemented in WebCoreIconDatabaseBridge so we can be in ObjC++ and fire off a loader in Webkit
- // Once all of the loader logic is sufficiently moved into WebCore we need to move this implementation to IconDatabase.cpp
- // using WebCore-style loaders
- // void loadIconFromURL(const String&);
-
- static IconDatabase* m_sharedInstance;
-
SQLDatabase m_mainDB;
SQLDatabase m_privateBrowsingDB;
SQLDatabase* m_currentDB;
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "IconDatabase.h"
#include "Logging.h"
#include "ResourceHandle.h"
void IconLoader::finishLoading(const KURL& iconURL)
{
IconDatabase::sharedIconDatabase()->setIconDataForIconURL(m_buffer.data(), m_buffer.size(), iconURL.url());
-
- // Tell the frame to map its URL(s) to its iconURL in the database.
m_frame->loader()->commitIconURLToIconDatabase(iconURL);
-
- // Send the notification to the app that this icon is finished loading.
-#if PLATFORM(MAC) // turn this on for other platforms when FrameLoader is deployed more fully
- m_frame->loader()->notifyIconChanged();
-#endif
-
+ m_frame->loader()->client()->dispatchDidReceiveIcon();
clearLoadingState();
}
#import "HTMLFormElement.h"
#import "HTMLFrameElement.h"
#import "HTMLNames.h"
+#import "IconDatabase.h"
#import "LoaderNSURLExtras.h"
#import "LoaderNSURLRequestExtras.h"
#import "MainResourceLoader.h"
#import "SystemTime.h"
#import "TextResourceDecoder.h"
#import "WebCoreFrameBridge.h"
-#import "WebCoreIconDatabaseBridge.h"
#import "WebCorePageState.h"
#import "WebCoreSystemInterface.h"
#import "WebDataProtocol.h"
activeDocumentLoader()->mainReceivedError(error, isComplete);
}
-void FrameLoader::notifyIconChanged()
-{
- ASSERT([[WebCoreIconDatabaseBridge sharedInstance] _isEnabled]);
- NSImage *icon = [[WebCoreIconDatabaseBridge sharedInstance]
- iconForPageURL:urlOriginalDataAsString(activeDocumentLoader()->URL().getNSURL())
- withSize:NSMakeSize(16, 16)];
- m_client->dispatchDidReceiveIcon(icon);
-}
-
NSError *FrameLoader::cancelledError(NSURLRequest *request) const
{
return m_client->cancelledError(request);
+2006-11-10 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin
+
+ Took out WebIconDatabaseBridge and made WebKit call IconDatabase directly
+
+ * Misc/WebIconDatabase.m:
+ (-[WebIconDatabase init]):
+ (-[WebIconDatabase iconForURL:withSize:cache:]):
+ (-[WebIconDatabase iconURLForURL:]):
+ (-[WebIconDatabase defaultIconWithSize:]):
+ (-[WebIconDatabase defaultIconForURL:withSize:]):
+ (-[WebIconDatabase retainIconForURL:]):
+ (-[WebIconDatabase releaseIconForURL:]):
+ (-[WebIconDatabase setDelegate:]):
+ (-[WebIconDatabase removeAllIcons]):
+ (-[WebIconDatabase isIconExpiredForIconURL:]):
+ (-[WebIconDatabase _isEnabled]):
+ (-[WebIconDatabase _setIconData:forIconURL:]):
+ (-[WebIconDatabase _setHaveNoIconForIconURL:]):
+ (-[WebIconDatabase _setIconURL:forURL:]):
+ (-[WebIconDatabase _hasEntryForIconURL:]):
+ (-[WebIconDatabase _applicationWillTerminate:]):
+ (-[WebIconDatabase _resetCachedWebPreferences:]):
+ (-[WebIconDatabase _convertToWebCoreFormat]):
+ (webGetNSImage):
+ * Misc/WebIconDatabaseInternal.h: Added.
+ * Misc/WebIconDatabasePrivate.h:
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchDidReceiveIcon):
+ * WebCoreSupport/WebIconDatabaseBridge.h: Removed.
+ * WebCoreSupport/WebIconDatabaseBridge.m: Removed.
+ * WebKit.xcodeproj/project.pbxproj:
+
2006-11-09 Oliver Hunt <oliver@apple.com>
Reviewed by Brady.
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebKit/WebIconDatabase.h>
-#import "WebIconDatabaseDelegate.h"
-#import <WebKit/WebIconDatabasePrivate.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebKitNSStringExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebPreferences.h>
-
-#import <WebKit/WebIconDatabaseBridge.h>
+#import "WebIconDatabaseInternal.h"
+#import "WebIconDatabaseDelegate.h"
+#import "WebKitLogging.h"
+#import "WebKitNSStringExtras.h"
+#import "WebNSURLExtras.h"
+#import "WebPreferences.h"
#import "WebTypesInternal.h"
+#import <WebCore/IconDatabase.h>
+#import <WebCore/Image.h>
+#import <WebCore/IntSize.h>
+
+using namespace WebCore;
NSString * const WebIconDatabaseVersionKey = @"WebIconDatabaseVersion";
NSString * const WebURLToIconURLKey = @"WebSiteURLToIconURLKey";
_private = [[WebIconDatabasePrivate alloc] init];
- // Get/create the shared database bridge - bail if we fail
- _private->databaseBridge = [WebIconDatabaseBridge sharedInstance];
- if (!_private->databaseBridge) {
- LOG_ERROR("Unable to create IconDatabaseBridge");
- return self;
- }
-
// Check the user defaults and see if the icon database should even be enabled.
// Inform the bridge and, if we're disabled, bail from init right here
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults registerDefaults:initialDefaults];
[initialDefaults release];
BOOL enabled = [defaults boolForKey:WebIconDatabaseEnabledDefaultsKey];
- [_private->databaseBridge _setEnabled:enabled];
+ IconDatabase::sharedIconDatabase()->setEnabled(enabled);
if (!enabled)
return self;
databaseDirectory = WebIconDatabasePath;
[defaults setObject:databaseDirectory forKey:WebIconDatabaseDirectoryDefaultsKey];
}
- databaseDirectory = [databaseDirectory stringByExpandingTildeInPath];
+ databaseDirectory = [[databaseDirectory stringByExpandingTildeInPath] stringByStandardizingPath];
// Open the WebCore icon database and convert the old WebKit icon database if we haven't done the initial conversion yet
- if (![_private->databaseBridge openSharedDatabaseWithPath:databaseDirectory])
- LOG_ERROR("Unable to open IconDatabaseBridge");
+ if (!IconDatabase::sharedIconDatabase()->open(databaseDirectory))
+ LOG_ERROR("Unable to open icon database");
else
if ([self _isEnabled])
[self _convertToWebCoreFormat];
- [_private->databaseBridge setPrivateBrowsingEnabled:[[WebPreferences standardPreferences] privateBrowsingEnabled]];
+ IconDatabase::sharedIconDatabase()->setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]);
// Register for important notifications
[[NSNotificationCenter defaultCenter] addObserver:self
if ([URL _webkit_isFileURL])
return [self _iconForFileURL:URL withSize:size];
- NSImage* image = [_private->databaseBridge iconForPageURL:URL withSize:size];
- if (image)
- return image;
+ if (Image* image = IconDatabase::sharedIconDatabase()->iconForPageURL(URL, IntSize(size)))
+ if (NSImage *icon = webGetNSImage(image, size))
+ return icon;
return [self defaultIconForURL:URL withSize:size];
}
if (![self _isEnabled])
return nil;
- NSString* iconurl = [_private->databaseBridge iconURLForPageURL:URL];
- return iconurl;
+ return IconDatabase::sharedIconDatabase()->iconURLForPageURL(URL);
}
- (NSImage *)defaultIconWithSize:(NSSize)size
ASSERT(size.width);
ASSERT(size.height);
- return [_private->databaseBridge defaultIconWithSize:size];
+ Image* image = IconDatabase::sharedIconDatabase()->defaultIcon(IntSize(size));
+ return image ? image->getNSImage() : nil;
}
- (NSImage *)defaultIconForURL:(NSString *)URL withSize:(NSSize)size
{
- if (_private->delegateDefaultIconForURL)
+ if (_private->delegateImplementsDefaultIconForURL)
return [_private->delegate webIconDatabase:self defaultIconForURL:URL withSize:size];
- return [_private->databaseBridge defaultIconWithSize:size];
+ return [self defaultIconWithSize:size];
}
- (void)retainIconForURL:(NSString *)URL
if (![self _isEnabled])
return;
- [_private->databaseBridge retainIconForURL:URL];
+ IconDatabase::sharedIconDatabase()->retainIconForPageURL(URL);
}
- (void)releaseIconForURL:(NSString *)pageURL
if (![self _isEnabled])
return;
- [_private->databaseBridge releaseIconForURL:pageURL];
+ IconDatabase::sharedIconDatabase()->releaseIconForPageURL(pageURL);
}
- (void)setDelegate:(id)delegate
{
_private->delegate = delegate;
- _private->delegateDefaultIconForURL = [delegate respondsToSelector:@selector(webIconDatabase:defaultIconForURL:withSize:)];
+ _private->delegateImplementsDefaultIconForURL = [delegate respondsToSelector:@selector(webIconDatabase:defaultIconForURL:withSize:)];
}
- (id)delegate
- (void)removeAllIcons
{
- // <rdar://problem/4678414> - New IconDB needs to delete icons when asked
-
if (![self _isEnabled])
return;
-
- [_private->databaseBridge removeAllIcons];
-
+ IconDatabase::sharedIconDatabase()->removeAllIcons();
+ // FIXME: This notification won't get sent if WebCore calls removeAllIcons.
[[NSNotificationCenter defaultCenter] postNotificationName:WebIconDatabaseDidRemoveAllIconsNotification
object:self
userInfo:nil];
- (BOOL)isIconExpiredForIconURL:(NSString *)iconURL
{
- return [_private->databaseBridge isIconExpiredForIconURL:iconURL];
+ return IconDatabase::sharedIconDatabase()->isIconExpiredForIconURL(iconURL);
}
@end
- (BOOL)_isEnabled
{
- // If we weren't enabled on startup, we marked the databaseBridge as nil
- return [_private->databaseBridge _isEnabled];
+ return IconDatabase::sharedIconDatabase()->enabled();
}
- (void)_setIconData:(NSData *)data forIconURL:(NSString *)iconURL
ASSERT(iconURL);
ASSERT([self _isEnabled]);
- [_private->databaseBridge _setIconData:data forIconURL:iconURL];
+ IconDatabase::sharedIconDatabase()->setIconDataForIconURL([data bytes], [data length], iconURL);
}
- (void)_setHaveNoIconForIconURL:(NSString *)iconURL
ASSERT(iconURL);
ASSERT([self _isEnabled]);
- [_private->databaseBridge _setHaveNoIconForIconURL:iconURL];
+ IconDatabase::sharedIconDatabase()->setHaveNoIconForIconURL(iconURL);
}
- (void)_setIconURL:(NSString *)iconURL forURL:(NSString *)URL
// If this iconURL already maps to this pageURL, don't bother sending the notification
// The WebCore::IconDatabase returns TRUE if we should send the notification, and false if we shouldn't.
// This is a measurable win on the iBench - about 1% worth on average
- if ([_private->databaseBridge _setIconURL:iconURL forPageURL:URL])
+ if (IconDatabase::sharedIconDatabase()->setIconURLForPageURL(iconURL, URL))
+ // FIXME: This notification won't get set when WebCore sets an icon.
[self _sendNotificationForURL:URL];
}
{
ASSERT([self _isEnabled]);
- return [_private->databaseBridge _hasEntryForIconURL:iconURL];
+ return IconDatabase::sharedIconDatabase()->hasEntryForIconURL(iconURL);
}
- (void)_sendNotificationForURL:(NSString *)URL
- (void)_applicationWillTerminate:(NSNotification *)notification
{
- [_private->databaseBridge closeSharedDatabase];
+ IconDatabase::sharedIconDatabase()->close();
}
-
- (NSImage *)_iconForFileURL:(NSString *)file withSize:(NSSize)size
{
ASSERT(size.width);
- (void)_resetCachedWebPreferences:(NSNotification *)notification
{
BOOL privateBrowsingEnabledNow = [[WebPreferences standardPreferences] privateBrowsingEnabled];
-
- [_private->databaseBridge setPrivateBrowsingEnabled:privateBrowsingEnabledNow];
+ IconDatabase::sharedIconDatabase()->setPrivateBrowsingEnabled(privateBrowsingEnabledNow);
}
- (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons
- (void)_convertToWebCoreFormat
{
- ASSERT(_private);
- ASSERT(_private->databaseBridge);
-
+ ASSERT(_private);
// If the WebCore Icon Database is not empty, we assume that this conversion has already
// taken place and skip the rest of the steps
- if (![_private->databaseBridge _isEmpty]) {
+ if (!IconDatabase::sharedIconDatabase()->isEmpty())
return;
- }
// Get the directory the old icon database *should* be in
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
iconURL = [pageURLToIconURL objectForKey:url];
if (!iconURL)
continue;
- [_private->databaseBridge _setIconURL:iconURL forPageURL:url];
+ IconDatabase::sharedIconDatabase()->setIconURLForPageURL(iconURL, url);
}
// Second, we'll get a list of the unique IconURLs we have
while ((url = [enumerator nextObject]) != nil) {
iconData = iconDataFromPathForIconURL(databaseDirectory, url);
if (iconData)
- [_private->databaseBridge _setIconData:iconData forIconURL:url];
+ IconDatabase::sharedIconDatabase()->setIconDataForIconURL([iconData bytes], [iconData length], url);
else {
// This really *shouldn't* happen, so it'd be good to track down why it might happen in a debug build
// however, we do know how to handle it gracefully in release
LOG_ERROR("%@ is marked as having an icon on disk, but we couldn't get the data for it", url);
- [_private->databaseBridge _setHaveNoIconForIconURL:url];
+ IconDatabase::sharedIconDatabase()->setHaveNoIconForIconURL(url);
}
}
NSFileManager *fileManager = [NSFileManager defaultManager];
enumerator = [[fileManager directoryContentsAtPath:databaseDirectory] objectEnumerator];
- NSString *databaseFilename = [_private->databaseBridge defaultDatabaseFilename];
+ NSString *databaseFilename = IconDatabase::sharedIconDatabase()->defaultDatabaseFilename();
NSString *file;
while ((file = [enumerator nextObject]) != nil) {
@end
-// This empty implementation must exist
@implementation WebIconDatabasePrivate
@end
+NSImage *webGetNSImage(Image* image, NSSize size)
+{
+ ASSERT(size.width);
+ ASSERT(size.height);
+
+ // FIXME: We're doing the resize here for now because WebCore::Image doesn't yet support resizing/multiple representations
+ // This makes it so there's effectively only one size of a particular icon in the system at a time. We should move this
+ // to WebCore::Image at some point.
+ if (!image)
+ return nil;
+ NSImage* nsImage = image->getNSImage();
+ if (!nsImage)
+ return nil;
+ if (!NSEqualSizes([nsImage size], size)) {
+ [nsImage setScalesWhenResized:YES];
+ [nsImage setSize:size];
+ }
+ return nsImage;
+}
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebCore/WebCoreIconDatabaseBridge.h>
+#import "WebIconDatabasePrivate.h"
-@interface WebIconDatabaseBridge : WebCoreIconDatabaseBridge <WebCoreIconDatabaseBridge>
-{
+namespace WebCore {
+ class Image;
+}
+
+@interface WebIconDatabasePrivate : NSObject {
+@public
+ id delegate;
+ BOOL delegateImplementsDefaultIconForURL;
+ NSMutableDictionary *htmlIcons;
}
@end
+
+NSImage *webGetNSImage(WebCore::Image*, NSSize);
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Cocoa/Cocoa.h>
#import <WebKit/WebIconDatabase.h>
+// FIXME: Some of the following is not API and should be moved
+// either inside WebIconDatabase.mm, or to WebIconDatabaseInternal.h.
-@class WebCoreIconDatabaseBridge;
-@class WebDataSource;
-
-@interface WebIconDatabasePrivate : NSObject {
-
-@public
- WebCoreIconDatabaseBridge *databaseBridge;
- id delegate;
-
- BOOL delegateDefaultIconForURL;
-
- NSMutableDictionary *htmlIcons;
- NSMutableDictionary *defaultIcons;
-}
-
-@end
-
-// Sent when all icons are removed from the databse. The object of the notification is
+// Sent when all icons are removed from the database. The object of the notification is
// the icon database. There is no userInfo. Clients should react by removing any cached
// icon images from the user interface. Clients need not and should not call
// releaseIconForURL: in response to this notification.
extern NSString *WebIconDatabaseDidRemoveAllIconsNotification;
@interface WebIconDatabase (WebPendingPublic)
+
/*!
@method removeAllIcons:
@discussion Causes the icon database to delete all of the images that it has stored,
@interface WebIconDatabase (WebPrivate)
-- (BOOL)_isEnabled;
+// None of these are used in WebKit outside WebIconDatabase.m, so if we can verify that
+// they are not used outside WebKit, then we can just remove these declarations and
+// make them "file internal".
-// Called by WebDataSource to bind a web site URL to a icon URL and icon image.
+- (BOOL)_isEnabled;
- (void)_setIconURL:(NSString *)iconURL forURL:(NSString *)URL;
-
- (BOOL)_hasEntryForIconURL:(NSString *)iconURL;
- (void)_sendNotificationForURL:(NSString *)URL;
virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate);
virtual void dispatchDidChangeLocationWithinPage();
virtual void dispatchWillClose();
- virtual void dispatchDidReceiveIcon(NSImage *);
+ virtual void dispatchDidReceiveIcon();
virtual void dispatchDidStartProvisionalLoad();
virtual void dispatchDidReceiveTitle(const WebCore::String& title);
virtual void dispatchDidCommitLoad();
#import "WebDownloadInternal.h"
#import "WebElementDictionary.h"
#import "WebFormDelegate.h"
+#import "WebFrameBridge.h"
#import "WebFrameInternal.h"
#import "WebFrameLoadDelegate.h"
#import "WebFrameViewInternal.h"
#import "WebHTMLView.h"
#import "WebHistoryItemPrivate.h"
#import "WebHistoryPrivate.h"
+#import "WebIconDatabaseInternal.h"
#import "WebKitErrorsPrivate.h"
#import "WebKitNSStringExtras.h"
#import "WebNSURLExtras.h"
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameLoaderTypes.h>
#import <WebCore/FrameMac.h>
+#import <WebCore/IconDatabase.h>
#import <WebCore/PageState.h>
#import <WebCore/FrameTree.h>
#import <WebCore/MouseEvent.h>
[[webView _frameLoadDelegateForwarder] webView:webView willCloseFrame:m_webFrame.get()];
}
-void WebFrameLoaderClient::dispatchDidReceiveIcon(NSImage *icon)
+void WebFrameLoaderClient::dispatchDidReceiveIcon()
{
WebView *webView = getWebView(m_webFrame.get());
ASSERT([m_webFrame.get() _isMainFrame]);
+ // FIXME: This willChangeValueForKey call is too late, because the icon has already changed by now.
[webView _willChangeValueForKey:_WebMainFrameIconKey];
- [[webView _frameLoadDelegateForwarder] webView:webView didReceiveIcon:icon forFrame:m_webFrame.get()];
+ id delegate = [webView frameLoadDelegate];
+ if ([delegate respondsToSelector:@selector(webView:didReceiveIcon:forFrame:)]) {
+ Image* image = IconDatabase::sharedIconDatabase()->
+ iconForPageURL(core(m_webFrame.get())->loader()->url().url(), IntSize(16, 16));
+ NSImage *icon = webGetNSImage(image, NSMakeSize(16, 16));
+ if (icon)
+ [delegate webView:webView didReceiveIcon:icon forFrame:m_webFrame.get()];
+ }
[webView _didChangeValueForKey:_WebMainFrameIconKey];
}
+++ /dev/null
-/*
- * Copyright (C) 2006 Apple Computer, 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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.
- */
-
-#import "WebIconDatabaseBridge.h"
-
-#import "WebIconDatabasePrivate.h"
-#import <JavaScriptCore/Assertions.h>
-
-@implementation WebIconDatabaseBridge
-
-// Only sharedInstance is allowed to create the bridge.
-// Return nil if someone tries to init.
-- (id)init
-{
- [self release];
- return nil;
-}
-
-- (id)_init
-{
- self = [super init];
- return self;
-}
-
-// FIXME rdar://4668102 - This is a likely place to add an NSNotification here to notify the app of the updated icon
-- (void)_setIconData:(NSData *)data forIconURL:(NSString *)iconURL
-{
- [super _setIconData:data forIconURL:iconURL];
-}
-
-// FIXME rdar://4668102 - This is a likely place to add an NSNotification here to notify the app of the updated icon
-- (void)_setHaveNoIconForIconURL:(NSString *)iconURL
-{
- [super _setHaveNoIconForIconURL:iconURL];
-}
-
-+ (WebCoreIconDatabaseBridge *)createInstance
-{
- return [[WebIconDatabaseBridge alloc] _init];
-}
-
-- (void)dealloc
-{
- // The single instance should be kept around forever, so this code should never be reached.
- ASSERT(false);
- [super dealloc];
-}
-
-- (void)finalize
-{
- // The single instance should be kept around forever, so this code should never be reached.
- ASSERT(false);
- [super finalize];
-}
-
-@end
4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; };
4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; };
51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
- 51E4D3990A886B5E00ECEE2C /* WebIconDatabaseBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4D3970A886B5E00ECEE2C /* WebIconDatabaseBridge.h */; };
- 51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E4D3980A886B5E00ECEE2C /* WebIconDatabaseBridge.m */; };
650F74E409E488F70020118A /* WebUnarchivingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F74E209E488F70020118A /* WebUnarchivingState.h */; };
650F74E509E488F70020118A /* WebUnarchivingState.m in Sources */ = {isa = PBXBuildFile; fileRef = 650F74E309E488F70020118A /* WebUnarchivingState.m */; };
65488DA1084FBCCB00831AD0 /* WebNSDictionaryExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */; };
7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.m */; };
7E6FEF0A08985A7200C44C3F /* WebScriptDebugDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0708985A7200C44C3F /* WebScriptDebugDelegatePrivate.h */; };
+ 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */; };
931633EB0AEDFF930062B92D /* WebFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */; };
931633EF0AEDFFAE0062B92D /* WebFrameLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */; };
939810110824BF01008DF038 /* WebBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 3944607D020F50ED0ECA1767 /* WebBackForwardList.h */; settings = {ATTRIBUTES = (Public, ); }; };
51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };
51C16E4006138EB400A1657B /* npfunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = npfunctions.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 51E4D3970A886B5E00ECEE2C /* WebIconDatabaseBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseBridge.h; sourceTree = "<group>"; };
- 51E4D3980A886B5E00ECEE2C /* WebIconDatabaseBridge.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebIconDatabaseBridge.m; sourceTree = "<group>"; };
51E94C3406C0321200A9B09E /* WebPDFView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51E94C3506C0321200A9B09E /* WebPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84CA5F7E042685E800CA2ACA /* WebKitErrorsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitErrorsPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84D4BFF70348EF7600CA2ACA /* WebNetscapePluginEmbeddedView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapePluginEmbeddedView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
84D4BFF80348EF7600CA2ACA /* WebNetscapePluginEmbeddedView.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebNetscapePluginEmbeddedView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseInternal.h; sourceTree = "<group>"; };
9305892A070868B300E79D96 /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
930D02BB06275F640076701E /* WebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
930D02BD06275F710076701E /* WebFrameInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F5143A370221DCCE01A80181 /* WebFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrame.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F520FB190221DEFD01C1A525 /* WebHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistory.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F528E3E9031E91AD01CA2ACA /* WebIconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabase.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- F528E3EA031E91AD01CA2ACA /* WebIconDatabase.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebIconDatabase.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ F528E3EA031E91AD01CA2ACA /* WebIconDatabase.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebIconDatabase.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F528E3EB031E91AD01CA2ACA /* WebIconDatabasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabasePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F53444CE02E87CBA018635CA /* WebKitStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitStatistics.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F53444CF02E87CBA018635CA /* WebKitStatistics.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebKitStatistics.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F528E3E9031E91AD01CA2ACA /* WebIconDatabase.h */,
F528E3EA031E91AD01CA2ACA /* WebIconDatabase.m */,
51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */,
+ 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */,
F528E3EB031E91AD01CA2ACA /* WebIconDatabasePrivate.h */,
2568C72C0174912D0ECA149E /* WebKit.h */,
F5927D4E02D26C5E01CA2DBB /* WebKitErrors.h */,
F5AFB45F02B94DC8018635CA /* WebFrameBridge.mm */,
931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */,
931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */,
- 51E4D3970A886B5E00ECEE2C /* WebIconDatabaseBridge.h */,
- 51E4D3980A886B5E00ECEE2C /* WebIconDatabaseBridge.m */,
9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */,
9345D4EA0365C5B2008635CE /* WebJavaScriptTextInputPanel.h */,
9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */,
DD7CDEE70A23BA9E00069928 /* WebTypesInternal.h in Headers */,
1C0706630A431E01001078F6 /* WebScriptDebugServer.h in Headers */,
1C07079A0A433E22001078F6 /* WebScriptDebugServerPrivate.h in Headers */,
- 51E4D3990A886B5E00ECEE2C /* WebIconDatabaseBridge.h in Headers */,
1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */,
65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoaderMac.h in Headers */,
51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */,
656D333E0AF21AE900212169 /* WebResourceLoadDelegatePrivate.h in Headers */,
931633EB0AEDFF930062B92D /* WebFrameLoaderClient.h in Headers */,
14D8252F0AF955090004F057 /* WebChromeClient.h in Headers */,
+ 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
650F74E509E488F70020118A /* WebUnarchivingState.m in Sources */,
93EB178D09F88D460091F8FF /* WebSystemInterface.m in Sources */,
1C07073D0A433BD8001078F6 /* WebScriptDebugServer.m in Sources */,
- 51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */,
1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm in Sources */,
4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */,