summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/history_publisher_win.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 18:20:17 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 18:20:17 +0000
commit00d60fa690f04d37f7cc34688b8511cd3397fc3b (patch)
treec2eab34e6bed1a6786db15c78db4d1f66859ade3 /chrome/browser/history/history_publisher_win.cc
parent39e537e316d35c2dd5181deb445f0420d4dc23b1 (diff)
downloadchromium_src-00d60fa690f04d37f7cc34688b8511cd3397fc3b.zip
chromium_src-00d60fa690f04d37f7cc34688b8511cd3397fc3b.tar.gz
chromium_src-00d60fa690f04d37f7cc34688b8511cd3397fc3b.tar.bz2
Miscellaneous tiny cleanups done while converting files to use ScopedCOMInitializer, pulled out separately to make review easier.
BUG=none TEST=none Review URL: https://codereview.chromium.org/10991052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_publisher_win.cc')
-rw-r--r--chrome/browser/history/history_publisher_win.cc38
1 files changed, 12 insertions, 26 deletions
diff --git a/chrome/browser/history/history_publisher_win.cc b/chrome/browser/history/history_publisher_win.cc
index 51c72a6..ac04a87 100644
--- a/chrome/browser/history/history_publisher_win.cc
+++ b/chrome/browser/history/history_publisher_win.cc
@@ -20,36 +20,22 @@
namespace {
-// Instantiates a IChromeHistoryIndexer COM object. Takes a COM class id
-// in |name| and returns the object in |indexer|. Returns false if the
-// operation fails.
-bool CoCreateIndexerFromName(const wchar_t* name,
- IChromeHistoryIndexer** indexer) {
- CLSID clsid;
- HRESULT hr = CLSIDFromString(const_cast<wchar_t*>(name), &clsid);
- if (FAILED(hr))
- return false;
- hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC,
- __uuidof(IChromeHistoryIndexer),
- reinterpret_cast<void**>(indexer));
- if (FAILED(hr))
- return false;
- return true;
-}
-
// Instantiates the registered indexers from the registry |root| + |path| key
// and adds them to the |indexers| list.
-void AddRegisteredIndexers(HKEY root, const wchar_t* path,
+void AddRegisteredIndexers(
+ HKEY root,
+ const wchar_t* path,
std::vector< base::win::ScopedComPtr<IChromeHistoryIndexer> >* indexers) {
- IChromeHistoryIndexer* indexer;
- base::win::RegistryKeyIterator r_iter(root, path);
- while (r_iter.Valid()) {
- if (CoCreateIndexerFromName(r_iter.Name(), &indexer)) {
- indexers->push_back(
- base::win::ScopedComPtr<IChromeHistoryIndexer>(indexer));
- indexer->Release();
+ for (base::win::RegistryKeyIterator r_iter(root, path); r_iter.Valid();
+ ++r_iter) {
+ CLSID clsid;
+ if (FAILED(CLSIDFromString(const_cast<wchar_t*>(r_iter.Name()), &clsid)))
+ continue;
+ base::win::ScopedComPtr<IChromeHistoryIndexer> indexer;
+ if (SUCCEEDED(indexer.CreateInstance(clsid, NULL, CLSCTX_INPROC))) {
+ indexers->push_back(indexer);
+ indexer.Release();
}
- ++r_iter;
}
}