webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
WebHistory.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2008, 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 WebHistory_H
27 #define WebHistory_H
28 
29 #include "WebKit.h"
30 #include <WebCore/COMPtr.h>
31 #include <memory>
32 #include <wtf/Forward.h>
33 #include <wtf/HashMap.h>
34 
35 namespace WebCore {
36  class URL;
37  class PageGroup;
38 }
39 
40 //-----------------------------------------------------------------------------
41 
42 class WebPreferences;
44 
45 class WebHistory : public IWebHistory, public IWebHistoryPrivate {
46 public:
47  static WebHistory* createInstance();
48 private:
49  WebHistory();
50  ~WebHistory();
51 
52 public:
53  // IUnknown
54  virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject);
55  virtual ULONG STDMETHODCALLTYPE AddRef();
56  virtual ULONG STDMETHODCALLTYPE Release();
57 
58  // IWebHistory
59  virtual HRESULT STDMETHODCALLTYPE optionalSharedHistory(_COM_Outptr_opt_ IWebHistory**);
60  virtual HRESULT STDMETHODCALLTYPE setOptionalSharedHistory(_In_opt_ IWebHistory*);
61  HRESULT STDMETHODCALLTYPE unused1() override;
62  HRESULT STDMETHODCALLTYPE unused2() override;
63  virtual HRESULT STDMETHODCALLTYPE addItems(int itemCount, __deref_in_ecount_opt(itemCount) IWebHistoryItem**);
64  virtual HRESULT STDMETHODCALLTYPE removeItems(int itemCount, __deref_in_ecount_opt(itemCount) IWebHistoryItem**);
65  virtual HRESULT STDMETHODCALLTYPE removeAllItems();
66  virtual HRESULT STDMETHODCALLTYPE orderedLastVisitedDays(_Inout_ int* count, _In_ DATE* calendarDates);
67  virtual HRESULT STDMETHODCALLTYPE orderedItemsLastVisitedOnDay(_Inout_ int* count, __deref_in_opt IWebHistoryItem** items, DATE calendarDate);
68  virtual HRESULT STDMETHODCALLTYPE itemForURL(_In_ BSTR url, _COM_Outptr_opt_ IWebHistoryItem**);
69  virtual HRESULT STDMETHODCALLTYPE setHistoryItemLimit(int);
70  virtual HRESULT STDMETHODCALLTYPE historyItemLimit(_Out_ int*);
71  virtual HRESULT STDMETHODCALLTYPE setHistoryAgeInDaysLimit(int);
72  virtual HRESULT STDMETHODCALLTYPE historyAgeInDaysLimit(_Out_ int*);
73 
74  // IWebHistoryPrivate
75  virtual HRESULT STDMETHODCALLTYPE allItems(_Inout_ int* count, __deref_opt_out IWebHistoryItem** items);
76  virtual HRESULT STDMETHODCALLTYPE setVisitedLinkTrackingEnabled(BOOL);
77  virtual HRESULT STDMETHODCALLTYPE removeAllVisitedLinks();
78 
79  // WebHistory
80  static WebHistory* sharedHistory();
81  void visitedURL(const WebCore::URL&, const WTF::String& title, const WTF::String& httpMethod, bool wasFailure, bool increaseVisitCount);
82  void addVisitedLinksToVisitedLinkStore(WebVisitedLinkStore&);
83 
84  COMPtr<IWebHistoryItem> itemForURLString(const WTF::String&) const;
85 
86  typedef int64_t DateKey;
87  typedef HashMap<DateKey, Vector<COMPtr<IWebHistoryItem>>> DateToEntriesMap;
88  typedef HashMap<WTF::String, COMPtr<IWebHistoryItem>> URLToEntriesMap;
89 
90 private:
91 
92  enum NotificationType
93  {
94  kWebHistoryItemsAddedNotification = 0,
95  kWebHistoryItemsRemovedNotification = 1,
96  kWebHistoryAllItemsRemovedNotification = 2,
97  kWebHistoryLoadedNotification = 3,
98  kWebHistoryItemsDiscardedWhileLoadingNotification = 4,
99  kWebHistorySavedNotification = 5
100  };
101 
102  HRESULT postNotification(NotificationType notifyType, IPropertyBag* userInfo = 0);
103  HRESULT removeItem(IWebHistoryItem* entry);
104  HRESULT addItem(IWebHistoryItem* entry, bool discardDuplicate, bool* added);
105  HRESULT removeItemForURLString(const WTF::String& urlString);
106  BSTR getNotificationString(NotificationType notifyType);
107 
108  ULONG m_refCount { 0 };
109  URLToEntriesMap m_entriesByURL;
110  COMPtr<WebPreferences> m_preferences;
111 };
112 
113 #endif
GLint GLsizei count
Definition: gl2.h:421
Definition: IWebHistoryItem.idl:45
unsigned long ULONG
Definition: MD5.h:32
HashMap< DateKey, Vector< COMPtr< IWebHistoryItem > > > DateToEntriesMap
Definition: WebHistory.h:87
signed long long int64_t
Definition: ptypes.h:112
Definition: WebPreferences.h:73
HRESULT
Definition: ScrollbarThemeWin.cpp:74
Definition: IWebHistory.idl:66
Definition: WTFString.h:78
title('Estimate ms')
sender AddRef()
Definition: IWebHistoryPrivate.idl:35
wchar_t * BSTR
Definition: BString.h:36
HashMap< WTF::String, COMPtr< IWebHistoryItem > > URLToEntriesMap
Definition: WebHistory.h:88
int Release(RepeatedCompositeContainer *self)
Definition: repeated_composite_container.cc:458
Definition: WebHistory.h:62
url
Definition: setup.py:223
Definition: URL.h:52
Definition: COMPtr.h:50
HANDLE hTheme BOOL
Definition: ScrollbarThemeWin.cpp:76
This file is generated by create-http-header-name-table, do not edit.
Definition: CharsetData.cpp:6
CFAllocatorRef CFURLRef URL
Definition: AVFoundationCFSoftLinking.h:225
int64_t DateKey
Definition: WebHistory.h:86