summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/history_publisher.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 19:03:40 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 19:03:40 +0000
commit599874373cf5ae8b1ba75afda760534063012ccd (patch)
treea2fc39478768610c538e34c6fc98032dec630760 /chrome/browser/history/history_publisher.h
parentded678ec915e3ca698c91d67611ba48f8a938511 (diff)
downloadchromium_src-599874373cf5ae8b1ba75afda760534063012ccd.zip
chromium_src-599874373cf5ae8b1ba75afda760534063012ccd.tar.gz
chromium_src-599874373cf5ae8b1ba75afda760534063012ccd.tar.bz2
Added a new interface IChromeHistoryIndexer which needs to be implemented by
indexers which are interested in indexing Chrome's web history. These should register their CLSID in HKCU\Software\Google\Google Chrome\IndexerPlugins and this is be used by Chrome to publish its index. Added code to publish the index too. Checked in for Vijay Thadkal <veejay.t.s@gmail.com> (Google). Reitveld #9007. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_publisher.h')
-rw-r--r--chrome/browser/history/history_publisher.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/chrome/browser/history/history_publisher.h b/chrome/browser/history/history_publisher.h
new file mode 100644
index 0000000..7c199ac
--- /dev/null
+++ b/chrome/browser/history/history_publisher.h
@@ -0,0 +1,81 @@
+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_
+#define CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_
+
+#include <vector>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "chrome/browser/history/history_types.h"
+#include "googleurl/src/gurl.h"
+
+#if defined(OS_WIN)
+#include <atlbase.h>
+#include <atlcomcli.h>
+#include "history_indexer.h"
+#endif
+
+namespace history {
+
+class HistoryPublisher {
+ public:
+ HistoryPublisher();
+ ~HistoryPublisher();
+
+ // Must call this function to complete initialization. Returns true if we
+ // need to publish data to any indexers registered with us. Returns false if
+ // there are none registered. On false, no other function should be called.
+ bool Init();
+
+ void PublishPageThumbnail(const std::vector<unsigned char>& thumbnail,
+ const GURL& url, const base::Time& time) const;
+ void PublishPageContent(const base::Time& time, const GURL& url,
+ const std::wstring& title,
+ const std::wstring& contents) const;
+ void DeleteUserHistoryBetween(const base::Time& begin_time,
+ const base::Time& end_time) const;
+
+ private:
+ struct PageData {
+ const base::Time& time;
+ const GURL& url;
+ const wchar_t* html;
+ const wchar_t* title;
+ const char* thumbnail_format;
+ const std::vector<unsigned char>* thumbnail;
+ };
+ void PublishDataToIndexers(const PageData& page_data) const;
+
+ // Converts time represented by the Time class object to variant time in UTC.
+ // Returns '0' if the time object is NULL.
+ static double TimeToUTCVariantTime(const base::Time& time);
+
+ // Initializes the indexer_list_ with the list of indexers that registered
+ // with us to index history. Returns true if there are any registered.
+ bool ReadRegisteredIndexersFromRegistry();
+
+ private:
+#if defined(OS_WIN)
+ typedef std::vector<CComPtr<IChromeHistoryIndexer> > IndexerList;
+
+ // The list of indexers registered to receive history data from us.
+ IndexerList indexers_;
+#endif
+
+ // The Registry key under HKCU where the indexers need to register their
+ // CLSID.
+ static const wchar_t* kRegKeyRegisteredIndexersInfo;
+
+ // The format of the thumbnail we pass to indexers.
+ static const char* kThumbnailImageFormat;
+
+ DISALLOW_COPY_AND_ASSIGN(HistoryPublisher);
+};
+
+} // namespace history
+
+#endif // CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_