| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_ | |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/strings/string16.h" | |
| 12 | |
| 13 #if defined(OS_WIN) | |
| 14 #include "base/win/scoped_com_initializer.h" | |
| 15 #include "base/win/scoped_comptr.h" | |
| 16 #include "history_indexer.h" | |
| 17 #endif | |
| 18 | |
| 19 // TODO(shess): HistoryPublisher is being deprecated. I am still | |
| 20 // trying to track down who depends on it, meanwhile talk to me | |
| 21 // before removing interactions with it. | |
| 22 | |
| 23 class GURL; | |
| 24 | |
| 25 namespace base { | |
| 26 class Time; | |
| 27 } | |
| 28 | |
| 29 namespace history { | |
| 30 | |
| 31 class HistoryPublisher { | |
| 32 public: | |
| 33 HistoryPublisher(); | |
| 34 ~HistoryPublisher(); | |
| 35 | |
| 36 // Must call this function to complete initialization. Returns true if we | |
| 37 // need to publish data to any indexers registered with us. Returns false if | |
| 38 // there are none registered. On false, no other function should be called. | |
| 39 bool Init(); | |
| 40 | |
| 41 void PublishPageContent(const base::Time& time, const GURL& url, | |
| 42 const string16& title, | |
| 43 const string16& contents) const; | |
| 44 | |
| 45 private: | |
| 46 struct PageData { | |
| 47 const base::Time& time; | |
| 48 const GURL& url; | |
| 49 const char16* html; | |
| 50 const char16* title; | |
| 51 }; | |
| 52 | |
| 53 void PublishDataToIndexers(const PageData& page_data) const; | |
| 54 | |
| 55 #if defined(OS_WIN) | |
| 56 // Initializes the indexer_list_ with the list of indexers that registered | |
| 57 // with us to index history. Returns true if there are any registered. | |
| 58 bool ReadRegisteredIndexersFromRegistry(); | |
| 59 | |
| 60 // Converts time represented by the Time class object to variant time in UTC. | |
| 61 // Returns '0' if the time object is NULL. | |
| 62 static double TimeToUTCVariantTime(const base::Time& time); | |
| 63 | |
| 64 typedef std::vector< base::win::ScopedComPtr< | |
| 65 IChromeHistoryIndexer> > IndexerList; | |
| 66 | |
| 67 // The list of indexers registered to receive history data from us. | |
| 68 IndexerList indexers_; | |
| 69 | |
| 70 // The Registry key under HKCU where the indexers need to register their | |
| 71 // CLSID. | |
| 72 static const wchar_t* const kRegKeyRegisteredIndexersInfo; | |
| 73 | |
| 74 base::win::ScopedCOMInitializer com_initializer_; | |
| 75 #endif | |
| 76 | |
| 77 // The format of the thumbnail we pass to indexers. | |
| 78 static const char* const kThumbnailImageFormat; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(HistoryPublisher); | |
| 81 }; | |
| 82 | |
| 83 } // namespace history | |
| 84 | |
| 85 #endif // CHROME_BROWSER_HISTORY_HISTORY_PUBLISHER_H_ | |
| OLD | NEW |