Home | History | Annotate | Download | only in win
      1 /*
      2  * Copyright (C) 2006, 2007, 2008 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 COMPUTER, 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 COMPUTER, 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 WebHistoryItem_H
     27 #define WebHistoryItem_H
     28 
     29 #include "WebKit.h"
     30 
     31 #include <CoreFoundation/CoreFoundation.h>
     32 #include <WebCore/PlatformString.h>
     33 #include <wtf/PassRefPtr.h>
     34 #include <wtf/RefPtr.h>
     35 
     36 namespace WebCore {
     37     class HistoryItem;
     38 }
     39 
     40 //-----------------------------------------------------------------------------
     41 
     42 class WebHistoryItem : public IWebHistoryItem, IWebHistoryItemPrivate
     43 {
     44 public:
     45     static WebHistoryItem* createInstance();
     46     static WebHistoryItem* createInstance(PassRefPtr<WebCore::HistoryItem>);
     47 protected:
     48     WebHistoryItem(PassRefPtr<WebCore::HistoryItem>);
     49     ~WebHistoryItem();
     50 
     51 public:
     52     // IUnknown
     53     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
     54     virtual ULONG STDMETHODCALLTYPE AddRef(void);
     55     virtual ULONG STDMETHODCALLTYPE Release(void);
     56 
     57     // IWebHistoryItem
     58     virtual HRESULT STDMETHODCALLTYPE initWithURLString(
     59         /* [in] */ BSTR urlString,
     60         /* [in] */ BSTR title,
     61         /* [in] */ DATE lastVisited);
     62 
     63     virtual HRESULT STDMETHODCALLTYPE originalURLString(
     64         /* [retval][out] */ BSTR *url);
     65 
     66     virtual HRESULT STDMETHODCALLTYPE URLString(
     67         /* [retval][out] */ BSTR *url);
     68 
     69     virtual HRESULT STDMETHODCALLTYPE title(
     70         /* [retval][out] */ BSTR *pageTitle);
     71 
     72     virtual HRESULT STDMETHODCALLTYPE lastVisitedTimeInterval(
     73         /* [retval][out] */ DATE *lastVisited);
     74 
     75     virtual HRESULT STDMETHODCALLTYPE setAlternateTitle(
     76         /* [in] */ BSTR title);
     77 
     78     virtual HRESULT STDMETHODCALLTYPE alternateTitle(
     79         /* [retval][out] */ BSTR* title);
     80 
     81     virtual HRESULT STDMETHODCALLTYPE icon(
     82         /* [out, retval] */ OLE_HANDLE *hBitmap);
     83 
     84     // IWebHistoryItemPrivate
     85     virtual HRESULT STDMETHODCALLTYPE initFromDictionaryRepresentation(void* dictionary);
     86     virtual HRESULT STDMETHODCALLTYPE dictionaryRepresentation(void** dictionary);
     87     virtual HRESULT STDMETHODCALLTYPE visitCount(int *count);
     88     virtual HRESULT STDMETHODCALLTYPE setVisitCount(int count);
     89     virtual HRESULT STDMETHODCALLTYPE hasURLString(BOOL* hasURL);
     90     virtual HRESULT STDMETHODCALLTYPE mergeAutoCompleteHints(IWebHistoryItem* otherItem);
     91     virtual HRESULT STDMETHODCALLTYPE setLastVisitedTimeInterval(DATE time);
     92     virtual HRESULT STDMETHODCALLTYPE setTitle(BSTR title);
     93     virtual HRESULT STDMETHODCALLTYPE RSSFeedReferrer(BSTR* url);
     94     virtual HRESULT STDMETHODCALLTYPE setRSSFeedReferrer(BSTR url);
     95     virtual HRESULT STDMETHODCALLTYPE hasPageCache(BOOL *hasCache);
     96     virtual HRESULT STDMETHODCALLTYPE setHasPageCache(BOOL hasCache);
     97     virtual HRESULT STDMETHODCALLTYPE target(BSTR* target);
     98     virtual HRESULT STDMETHODCALLTYPE isTargetItem(BOOL* result);
     99     virtual HRESULT STDMETHODCALLTYPE children(unsigned* childCount, SAFEARRAY** children);
    100     virtual HRESULT STDMETHODCALLTYPE lastVisitWasFailure(BOOL* wasFailure);
    101     virtual HRESULT STDMETHODCALLTYPE setLastVisitWasFailure(BOOL wasFailure);
    102     virtual HRESULT STDMETHODCALLTYPE lastVisitWasHTTPNonGet(BOOL* HTTPNonGet);
    103     virtual HRESULT STDMETHODCALLTYPE setLastVisitWasHTTPNonGet(BOOL HTTPNonGet);
    104     virtual HRESULT STDMETHODCALLTYPE redirectURLs(IEnumVARIANT**);
    105     virtual HRESULT STDMETHODCALLTYPE visitedWithTitle(BSTR title, BOOL increaseVisitCount);
    106     virtual HRESULT STDMETHODCALLTYPE getDailyVisitCounts(int* number, int** counts);
    107     virtual HRESULT STDMETHODCALLTYPE getWeeklyVisitCounts(int* number, int** counts);
    108     virtual HRESULT STDMETHODCALLTYPE recordInitialVisit();
    109     // WebHistoryItem
    110     WebCore::HistoryItem* historyItem() const;
    111 
    112 protected:
    113     ULONG m_refCount;
    114 
    115     RefPtr<WebCore::HistoryItem> m_historyItem;
    116     WTF::String m_alternateTitle;
    117 };
    118 
    119 #endif
    120