Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/history/history_publisher_win.cc

Issue 115309: Remove even more ATL dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/history_publisher.cc ('k') | chrome/browser/input_window_dialog_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/registry.h" 12 #include "base/registry.h"
13 #include "base/scoped_comptr_win.h"
13 14
14 namespace history { 15 namespace history {
15 16
16 const wchar_t* HistoryPublisher::kRegKeyRegisteredIndexersInfo = 17 const wchar_t* const HistoryPublisher::kRegKeyRegisteredIndexersInfo =
17 L"Software\\Google\\Google Chrome\\IndexerPlugins"; 18 L"Software\\Google\\Google Chrome\\IndexerPlugins";
18 19
19 // static 20 // static
20 double HistoryPublisher::TimeToUTCVariantTime(const base::Time& time) { 21 double HistoryPublisher::TimeToUTCVariantTime(const base::Time& time) {
21 double var_time = 0; 22 double var_time = 0;
22 if (!time.is_null()) { 23 if (!time.is_null()) {
23 base::Time::Exploded exploded; 24 base::Time::Exploded exploded;
24 time.UTCExplode(&exploded); 25 time.UTCExplode(&exploded);
25 26
26 // Create the system time struct representing our exploded time. 27 // Create the system time struct representing our exploded time.
(...skipping 26 matching lines...) Expand all
53 54
54 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { 55 bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() {
55 RegistryKeyIterator iter(HKEY_CURRENT_USER, kRegKeyRegisteredIndexersInfo); 56 RegistryKeyIterator iter(HKEY_CURRENT_USER, kRegKeyRegisteredIndexersInfo);
56 while (iter.Valid()) { 57 while (iter.Valid()) {
57 // The subkey name is the GUID of the Indexer COM object which implements 58 // The subkey name is the GUID of the Indexer COM object which implements
58 // the IChromeHistoryIndexer interface. We shall store that and use it to 59 // the IChromeHistoryIndexer interface. We shall store that and use it to
59 // send historical data to the indexer. 60 // send historical data to the indexer.
60 CLSID clsid; 61 CLSID clsid;
61 CLSIDFromString(static_cast<LPOLESTR>( 62 CLSIDFromString(static_cast<LPOLESTR>(
62 const_cast<TCHAR*>(iter.Name())), &clsid); 63 const_cast<TCHAR*>(iter.Name())), &clsid);
63 CComPtr<IChromeHistoryIndexer> indexer; 64 ScopedComPtr<IChromeHistoryIndexer> indexer;
64 HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC, 65 HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC,
65 __uuidof(IChromeHistoryIndexer), 66 __uuidof(IChromeHistoryIndexer),
66 reinterpret_cast<void**>(&indexer)); 67 reinterpret_cast<void**>(&indexer));
67 if (SUCCEEDED(hr) && indexer != NULL) 68 if (SUCCEEDED(hr) && indexer != NULL)
68 indexers_.push_back(indexer); 69 indexers_.push_back(indexer);
69 ++iter; 70 ++iter;
70 } 71 }
71 return indexers_.size() > 0; 72 return indexers_.size() > 0;
72 } 73 }
73 74
(...skipping 24 matching lines...) Expand all
98 const { 99 const {
99 double var_begin_time = TimeToUTCVariantTime(begin_time); 100 double var_begin_time = TimeToUTCVariantTime(begin_time);
100 double var_end_time = TimeToUTCVariantTime(end_time); 101 double var_end_time = TimeToUTCVariantTime(end_time);
101 for(size_t i = 0; i < indexers_.size(); ++i) { 102 for(size_t i = 0; i < indexers_.size(); ++i) {
102 indexers_[i]->DeleteUserHistoryBetween(CComVariant(var_begin_time, VT_DATE), 103 indexers_[i]->DeleteUserHistoryBetween(CComVariant(var_begin_time, VT_DATE),
103 CComVariant(var_end_time, VT_DATE)); 104 CComVariant(var_end_time, VT_DATE));
104 } 105 }
105 } 106 }
106 107
107 } // namespace history 108 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_publisher.cc ('k') | chrome/browser/input_window_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698