|
Lines 37-55
using namespace WebKit;
a/Source/WebKit2/UIProcess/API/efl/ewk_page_group.cpp_sec1
|
| 37 |
|
37 |
|
| 38 |
const char EwkPageGroup::defaultIdentifier[] = "defaultPageGroupIdentifier"; |
38 |
const char EwkPageGroup::defaultIdentifier[] = "defaultPageGroupIdentifier"; |
| 39 |
|
39 |
|
|
|
40 |
typedef HashMap<WKPageGroupRef, EwkPageGroup*> PageGroupMap; |
| 41 |
|
| 42 |
static inline PageGroupMap& pageGroupMap() |
| 43 |
{ |
| 44 |
DEFINE_STATIC_LOCAL(PageGroupMap, map, ()); |
| 45 |
return map; |
| 46 |
} |
| 47 |
|
| 40 |
static WKTypeRef convertFromCharToWKString(void* data) |
48 |
static WKTypeRef convertFromCharToWKString(void* data) |
| 41 |
{ |
49 |
{ |
| 42 |
return WKStringCreateWithUTF8CString(static_cast<char*>(data)); |
50 |
return WKStringCreateWithUTF8CString(static_cast<char*>(data)); |
| 43 |
} |
51 |
} |
| 44 |
|
52 |
|
|
|
53 |
PassRefPtr<EwkPageGroup> EwkPageGroup::findOrCreateWrapper(WKPageGroupRef pageGroupRef) |
| 54 |
{ |
| 55 |
if (pageGroupMap().contains(pageGroupRef)) |
| 56 |
return pageGroupMap().get(pageGroupRef); |
| 57 |
|
| 58 |
return adoptRef(new EwkPageGroup(pageGroupRef)); |
| 59 |
} |
| 60 |
|
| 61 |
PassRefPtr<EwkPageGroup> EwkPageGroup::create(const String& identifier) |
| 62 |
{ |
| 63 |
WKRetainPtr<WKStringRef> identifierRef = adoptWK(toCopiedAPI(identifier.isEmpty() ? defaultIdentifier : identifier)); |
| 64 |
WKRetainPtr<WKPageGroupRef> pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(identifierRef.get())); |
| 65 |
|
| 66 |
return adoptRef(new EwkPageGroup(pageGroupRef.get())); |
| 67 |
} |
| 68 |
|
| 45 |
EwkPageGroup::EwkPageGroup(WKPageGroupRef pageGroupRef) |
69 |
EwkPageGroup::EwkPageGroup(WKPageGroupRef pageGroupRef) |
| 46 |
: m_pageGroupRef(pageGroupRef) |
70 |
: m_pageGroupRef(pageGroupRef) |
| 47 |
{ |
71 |
{ |
|
|
72 |
PageGroupMap::AddResult result = pageGroupMap().add(pageGroupRef, this); |
| 73 |
ASSERT_UNUSED(result, result.isNewEntry); |
| 48 |
} |
74 |
} |
| 49 |
|
75 |
|
| 50 |
EwkPageGroup::EwkPageGroup(const String& identifier) |
76 |
EwkPageGroup::~EwkPageGroup() |
| 51 |
{ |
77 |
{ |
| 52 |
m_pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(adoptWK(toCopiedAPI(identifier)).get())); |
78 |
ASSERT(pageGroupMap().get(m_pageGroupRef.get()) == this); |
|
|
79 |
pageGroupMap().remove(m_pageGroupRef.get()); |
| 53 |
} |
80 |
} |
| 54 |
|
81 |
|
| 55 |
void EwkPageGroup::addUserStyleSheet(const String& source, const String& baseURL, Eina_List* whiteList, Eina_List* blackList, bool mainFrameOnly) |
82 |
void EwkPageGroup::addUserStyleSheet(const String& source, const String& baseURL, Eina_List* whiteList, Eina_List* blackList, bool mainFrameOnly) |