webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
WebIconDatabase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2009, 2013-2015 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef WebIconDatabase_H
27 #define WebIconDatabase_H
28 
29 #include "WebKit.h"
30 
31 #include <WebCore/IconDatabaseClient.h>
32 #include <WebCore/IntSize.h>
33 #include <WebCore/IntSizeHash.h>
34 #include <wtf/Lock.h>
35 #include <wtf/Threading.h>
36 #include <wtf/Vector.h>
37 
38 #include <windows.h>
39 
40 namespace WebCore
41 {
42  class IconDatabase;
43 }; //namespace WebCore
44 using namespace WebCore;
45 using namespace WTF;
46 
48 {
49 public:
50  static WebIconDatabase* createInstance();
51  static WebIconDatabase* sharedWebIconDatabase();
52 private:
54  ~WebIconDatabase();
55  void init();
56  void startUpIconDatabase();
57  void shutDownIconDatabase();
58 public:
59 
60  // IUnknown
61  virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject);
62  virtual ULONG STDMETHODCALLTYPE AddRef();
63  virtual ULONG STDMETHODCALLTYPE Release();
64 
65  // IWebIconDatabase
66  virtual HRESULT STDMETHODCALLTYPE sharedIconDatabase(_COM_Outptr_opt_ IWebIconDatabase**);
67  virtual HRESULT STDMETHODCALLTYPE iconForURL(_In_ BSTR url, _In_ LPSIZE, BOOL cache, __deref_opt_out HBITMAP* image);
68  virtual HRESULT STDMETHODCALLTYPE defaultIconWithSize(_In_ LPSIZE, __deref_opt_out HBITMAP* result);
69  virtual HRESULT STDMETHODCALLTYPE retainIconForURL(_In_ BSTR);
70  virtual HRESULT STDMETHODCALLTYPE releaseIconForURL(_In_ BSTR);
71  virtual HRESULT STDMETHODCALLTYPE removeAllIcons();
72  virtual HRESULT STDMETHODCALLTYPE delayDatabaseCleanup();
73  virtual HRESULT STDMETHODCALLTYPE allowDatabaseCleanup();
74  virtual HRESULT STDMETHODCALLTYPE iconURLForURL(_In_ BSTR url, __deref_opt_out BSTR* iconURL);
75  virtual HRESULT STDMETHODCALLTYPE isEnabled(_Out_ BOOL*);
76  virtual HRESULT STDMETHODCALLTYPE setEnabled(BOOL);
77  virtual HRESULT STDMETHODCALLTYPE hasIconForURL(_In_ BSTR url, _Out_ BOOL* result);
78 
79  // IconDatabaseClient
80  virtual void didRemoveAllIcons();
81  virtual void didImportIconURLForPageURL(const WTF::String&);
82  virtual void didImportIconDataForPageURL(const WTF::String&);
83  virtual void didChangeIconForPageURL(const WTF::String&);
84  virtual void didFinishURLImport();
85 
86  static BSTR iconDatabaseDidAddIconNotification();
87  static BSTR iconDatabaseDidRemoveAllIconsNotification();
88  static BSTR iconDatabaseNotificationUserInfoURLKey();
89 protected:
90  ULONG m_refCount { 0 };
92 
93  // Keep a set of HBITMAPs around for the default icon, and another
94  // to share amongst present site icons
95  HBITMAP getOrCreateSharedBitmap(const IntSize&);
96  HBITMAP getOrCreateDefaultIconBitmap(const IntSize&);
99 
102  void scheduleNotificationDelivery();
103  bool m_deliveryRequested { false };
104 
105  static void deliverNotifications(void*);
106 };
107 
108 #endif
HashMap< IntSize, HBITMAP > m_sharedIconMap
Definition: WebIconDatabase.h:98
Definition: IconDatabaseClient.h:35
unsigned long ULONG
Definition: MD5.h:32
Definition: IWebIconDatabase.idl:62
Lock m_notificationMutex
Definition: WebIconDatabase.h:100
HRESULT
Definition: ScrollbarThemeWin.cpp:74
Definition: WTFString.h:78
sender AddRef()
bool isEnabled()
Definition: bmalloc.h:82
wchar_t * BSTR
Definition: BString.h:36
Definition: WebIconDatabase.h:68
static WebIconDatabase * m_sharedWebIconDatabase
Definition: WebIconDatabase.h:91
Definition: IconDatabase.h:46
int Release(RepeatedCompositeContainer *self)
Definition: repeated_composite_container.cc:458
Definition: AirOpcode.h:161
result
Definition: target-blank-opener-post-window.php:5
void init()
Definition: HTMLNames.cpp:1637
Vector< String > m_notificationQueue
Definition: WebIconDatabase.h:101
url
Definition: setup.py:223
USVString iconURL
Definition: SiteBoundCredentialData.idl:28
Definition: image.py:1
HashMap< IntSize, HBITMAP > m_defaultIconMap
Definition: WebIconDatabase.h:97
HANDLE hTheme BOOL
Definition: ScrollbarThemeWin.cpp:76
This file is generated by create-http-header-name-table, do not edit.
Definition: CharsetData.cpp:6
Definition: Lock.h:133
Definition: IntSize.h:69
Definition: cache.py:1