|
Lines 27-32
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec1
|
| 27 |
#include "ewk_favicon_database.h" |
27 |
#include "ewk_favicon_database.h" |
| 28 |
|
28 |
|
| 29 |
#include "WKAPICast.h" |
29 |
#include "WKAPICast.h" |
|
|
30 |
#include "WKIconDatabase.h" |
| 30 |
#include "WKURL.h" |
31 |
#include "WKURL.h" |
| 31 |
#include "WebIconDatabase.h" |
32 |
#include "WebIconDatabase.h" |
| 32 |
#include "WebURL.h" |
33 |
#include "WebURL.h" |
|
Lines 38-45
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec2
|
| 38 |
|
39 |
|
| 39 |
using namespace WebKit; |
40 |
using namespace WebKit; |
| 40 |
|
41 |
|
| 41 |
Ewk_Favicon_Database::Ewk_Favicon_Database(WKIconDatabaseRef iconDatabaseRef) |
42 |
Ewk_Favicon_Database::Ewk_Favicon_Database(WebIconDatabase* iconDatabase) |
| 42 |
: m_wkIconDatabase(iconDatabaseRef) |
43 |
: m_iconDatabase(iconDatabase) |
| 43 |
{ |
44 |
{ |
| 44 |
WKIconDatabaseClient iconDatabaseClient; |
45 |
WKIconDatabaseClient iconDatabaseClient; |
| 45 |
memset(&iconDatabaseClient, 0, sizeof(WKIconDatabaseClient)); |
46 |
memset(&iconDatabaseClient, 0, sizeof(WKIconDatabaseClient)); |
|
Lines 47-59
Ewk_Favicon_Database::Ewk_Favicon_Database(WKIconDatabaseRef iconDatabaseRef)
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec3
|
| 47 |
iconDatabaseClient.clientInfo = this; |
48 |
iconDatabaseClient.clientInfo = this; |
| 48 |
iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL; |
49 |
iconDatabaseClient.didChangeIconForPageURL = didChangeIconForPageURL; |
| 49 |
iconDatabaseClient.iconDataReadyForPageURL = iconDataReadyForPageURL; |
50 |
iconDatabaseClient.iconDataReadyForPageURL = iconDataReadyForPageURL; |
| 50 |
WKIconDatabaseSetIconDatabaseClient(m_wkIconDatabase.get(), &iconDatabaseClient); |
51 |
WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), &iconDatabaseClient); |
|
|
52 |
} |
| 53 |
|
| 54 |
Ewk_Favicon_Database::~Ewk_Favicon_Database() |
| 55 |
{ |
| 51 |
} |
56 |
} |
| 52 |
|
57 |
|
| 53 |
String Ewk_Favicon_Database::iconURLForPageURL(const String& pageURL) const |
58 |
String Ewk_Favicon_Database::iconURLForPageURL(const String& pageURL) const |
| 54 |
{ |
59 |
{ |
| 55 |
String iconURL; |
60 |
String iconURL; |
| 56 |
toImpl(m_wkIconDatabase.get())->synchronousIconURLForPageURL(pageURL, iconURL); |
61 |
m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL); |
| 57 |
|
62 |
|
| 58 |
return iconURL; |
63 |
return iconURL; |
| 59 |
} |
64 |
} |
|
Lines 99-106
static Eina_Bool respond_icon_request_idle(void* data)
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec4
|
| 99 |
|
104 |
|
| 100 |
void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData) |
105 |
void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData) |
| 101 |
{ |
106 |
{ |
| 102 |
WebIconDatabase* webIconDatabase = toImpl(m_wkIconDatabase.get()); |
|
|
| 103 |
|
| 104 |
// We ask for the icon directly. If we don't get the icon data now, |
107 |
// We ask for the icon directly. If we don't get the icon data now, |
| 105 |
// we'll be notified later (even if the database is still importing icons). |
108 |
// we'll be notified later (even if the database is still importing icons). |
| 106 |
RefPtr<cairo_surface_t> surface = getIconSurfaceSynchronously(pageURL); |
109 |
RefPtr<cairo_surface_t> surface = getIconSurfaceSynchronously(pageURL); |
|
Lines 110-116
void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconReque
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec5
|
| 110 |
// finished yet, we need to wait for iconDataReadyForPageURL to be |
113 |
// finished yet, we need to wait for iconDataReadyForPageURL to be |
| 111 |
// called before making and informed decision. |
114 |
// called before making and informed decision. |
| 112 |
String iconURL = iconURLForPageURL(pageURL); |
115 |
String iconURL = iconURLForPageURL(pageURL); |
| 113 |
if (!surface && (!iconURL.isEmpty() || !webIconDatabase->isUrlImportCompleted())) { |
116 |
if (!surface && (!iconURL.isEmpty() || !m_iconDatabase->isUrlImportCompleted())) { |
| 114 |
PendingIconRequestVector requests = m_iconRequests.get(pageURL); |
117 |
PendingIconRequestVector requests = m_iconRequests.get(pageURL); |
| 115 |
requests.append(callbackData); |
118 |
requests.append(callbackData); |
| 116 |
m_iconRequests.set(pageURL, requests); |
119 |
m_iconRequests.set(pageURL, requests); |
|
Lines 139-151
void Ewk_Favicon_Database::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef p
a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp_sec6
|
| 139 |
|
142 |
|
| 140 |
PassRefPtr<cairo_surface_t> Ewk_Favicon_Database::getIconSurfaceSynchronously(const String& pageURL) const |
143 |
PassRefPtr<cairo_surface_t> Ewk_Favicon_Database::getIconSurfaceSynchronously(const String& pageURL) const |
| 141 |
{ |
144 |
{ |
| 142 |
WebIconDatabase* webIconDatabase = toImpl(m_wkIconDatabase.get()); |
145 |
m_iconDatabase->retainIconForPageURL(pageURL); |
| 143 |
|
|
|
| 144 |
webIconDatabase->retainIconForPageURL(pageURL); |
| 145 |
|
146 |
|
| 146 |
WebCore::NativeImagePtr icon = webIconDatabase->nativeImageForPageURL(pageURL); |
147 |
WebCore::NativeImagePtr icon = m_iconDatabase->nativeImageForPageURL(pageURL); |
| 147 |
if (!icon) { |
148 |
if (!icon) { |
| 148 |
webIconDatabase->releaseIconForPageURL(pageURL); |
149 |
m_iconDatabase->releaseIconForPageURL(pageURL); |
| 149 |
return 0; |
150 |
return 0; |
| 150 |
} |
151 |
} |
| 151 |
|
152 |
|