OLD | NEW |
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/history/history_publisher.h" | 5 #include "chrome/browser/history/history_publisher.h" |
6 | 6 |
7 #include <atlsafe.h> | 7 #include <atlsafe.h> |
8 #include <objbase.h> | 8 #include <objbase.h> |
9 #include <oleauto.h> | 9 #include <oleauto.h> |
10 #include <wtypes.h> | 10 #include <wtypes.h> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 // Peruse the registry for Indexer to instantiate and store in |indexers_|. | 100 // Peruse the registry for Indexer to instantiate and store in |indexers_|. |
101 // Return true if we found at least one indexer object. We look both in HKCU | 101 // Return true if we found at least one indexer object. We look both in HKCU |
102 // and HKLM. | 102 // and HKLM. |
103 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { | 103 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { |
104 AddRegisteredIndexers(HKEY_CURRENT_USER, | 104 AddRegisteredIndexers(HKEY_CURRENT_USER, |
105 kRegKeyRegisteredIndexersInfo, &indexers_); | 105 kRegKeyRegisteredIndexersInfo, &indexers_); |
106 AddRegisteredIndexers(HKEY_LOCAL_MACHINE, | 106 AddRegisteredIndexers(HKEY_LOCAL_MACHINE, |
107 kRegKeyRegisteredIndexersInfo, &indexers_); | 107 kRegKeyRegisteredIndexersInfo, &indexers_); |
108 return indexers_.size() > 0; | 108 return !indexers_.empty(); |
109 } | 109 } |
110 | 110 |
111 void HistoryPublisher::PublishDataToIndexers(const PageData& page_data) | 111 void HistoryPublisher::PublishDataToIndexers(const PageData& page_data) |
112 const { | 112 const { |
113 double var_time = TimeToUTCVariantTime(page_data.time); | 113 double var_time = TimeToUTCVariantTime(page_data.time); |
114 | 114 |
115 CComSafeArray<unsigned char> thumbnail_arr; | 115 CComSafeArray<unsigned char> thumbnail_arr; |
116 if (page_data.thumbnail) { | 116 if (page_data.thumbnail) { |
117 for (size_t i = 0; i < page_data.thumbnail->size(); ++i) | 117 for (size_t i = 0; i < page_data.thumbnail->size(); ++i) |
118 thumbnail_arr.Add((*page_data.thumbnail)[i]); | 118 thumbnail_arr.Add((*page_data.thumbnail)[i]); |
(...skipping 20 matching lines...) Expand all Loading... |
139 base::win::ScopedVariant var_begin_time(TimeToUTCVariantTime(begin_time), | 139 base::win::ScopedVariant var_begin_time(TimeToUTCVariantTime(begin_time), |
140 VT_DATE); | 140 VT_DATE); |
141 base::win::ScopedVariant var_end_time(TimeToUTCVariantTime(end_time), | 141 base::win::ScopedVariant var_end_time(TimeToUTCVariantTime(end_time), |
142 VT_DATE); | 142 VT_DATE); |
143 for (size_t i = 0; i < indexers_.size(); ++i) { | 143 for (size_t i = 0; i < indexers_.size(); ++i) { |
144 indexers_[i]->DeleteUserHistoryBetween(var_begin_time, var_end_time); | 144 indexers_[i]->DeleteUserHistoryBetween(var_begin_time, var_end_time); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 } // namespace history | 148 } // namespace history |
OLD | NEW |