OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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> | |
9 #include <oleauto.h> | 8 #include <oleauto.h> |
10 #include <wtypes.h> | 9 #include <wtypes.h> |
11 | 10 |
12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
13 #include "base/time.h" | 12 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
15 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
16 #include "base/win/scoped_bstr.h" | 15 #include "base/win/scoped_bstr.h" |
17 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
18 #include "base/win/scoped_variant.h" | 17 #include "base/win/scoped_variant.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 system_time.wMinute = exploded.minute; | 62 system_time.wMinute = exploded.minute; |
64 system_time.wSecond = exploded.second; | 63 system_time.wSecond = exploded.second; |
65 system_time.wMilliseconds = exploded.millisecond; | 64 system_time.wMilliseconds = exploded.millisecond; |
66 SystemTimeToVariantTime(&system_time, &var_time); | 65 SystemTimeToVariantTime(&system_time, &var_time); |
67 } | 66 } |
68 | 67 |
69 return var_time; | 68 return var_time; |
70 } | 69 } |
71 | 70 |
72 HistoryPublisher::HistoryPublisher() { | 71 HistoryPublisher::HistoryPublisher() { |
73 CoInitialize(NULL); | |
74 } | 72 } |
75 | 73 |
76 HistoryPublisher::~HistoryPublisher() { | 74 HistoryPublisher::~HistoryPublisher() { |
77 CoUninitialize(); | |
78 } | 75 } |
79 | 76 |
80 bool HistoryPublisher::Init() { | 77 bool HistoryPublisher::Init() { |
81 return ReadRegisteredIndexersFromRegistry(); | 78 return ReadRegisteredIndexersFromRegistry(); |
82 } | 79 } |
83 | 80 |
84 // Peruse the registry for Indexer to instantiate and store in |indexers_|. | 81 // Peruse the registry for Indexer to instantiate and store in |indexers_|. |
85 // Return true if we found at least one indexer object. We look both in HKCU | 82 // Return true if we found at least one indexer object. We look both in HKCU |
86 // and HKLM. | 83 // and HKLM. |
87 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { | 84 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 base::win::ScopedVariant var_begin_time(TimeToUTCVariantTime(begin_time), | 120 base::win::ScopedVariant var_begin_time(TimeToUTCVariantTime(begin_time), |
124 VT_DATE); | 121 VT_DATE); |
125 base::win::ScopedVariant var_end_time(TimeToUTCVariantTime(end_time), | 122 base::win::ScopedVariant var_end_time(TimeToUTCVariantTime(end_time), |
126 VT_DATE); | 123 VT_DATE); |
127 for (size_t i = 0; i < indexers_.size(); ++i) { | 124 for (size_t i = 0; i < indexers_.size(); ++i) { |
128 indexers_[i]->DeleteUserHistoryBetween(var_begin_time, var_end_time); | 125 indexers_[i]->DeleteUserHistoryBetween(var_begin_time, var_end_time); |
129 } | 126 } |
130 } | 127 } |
131 | 128 |
132 } // namespace history | 129 } // namespace history |
OLD | NEW |