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

Side by Side Diff: chrome/utility/importer/ie_importer_win.cc

Issue 2870263002: Rename ScopedComPtr::Receive to ScopedComPtr::GetAddressOf (Closed)
Patch Set: Rebase to 2a6f440 Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utility/importer/ie_importer_win.h" 5 #include "chrome/utility/importer/ie_importer_win.h"
6 6
7 #include <ole2.h> 7 #include <ole2.h>
8 #include <intshcut.h> 8 #include <intshcut.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 317
318 // Reads the URL of the favicon of the internet shortcut. 318 // Reads the URL of the favicon of the internet shortcut.
319 GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) { 319 GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) {
320 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage; 320 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage;
321 if (FAILED(property_set_storage.QueryFrom(url_locator))) 321 if (FAILED(property_set_storage.QueryFrom(url_locator)))
322 return GURL(); 322 return GURL();
323 323
324 base::win::ScopedComPtr<IPropertyStorage> property_storage; 324 base::win::ScopedComPtr<IPropertyStorage> property_storage;
325 if (FAILED(property_set_storage->Open(FMTID_Intshcut, STGM_READ, 325 if (FAILED(property_set_storage->Open(FMTID_Intshcut, STGM_READ,
326 property_storage.Receive()))) { 326 property_storage.GetAddressOf()))) {
327 return GURL(); 327 return GURL();
328 } 328 }
329 329
330 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}}; 330 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}};
331 // ReadMultiple takes a non-const array of PROPVARIANTs, but since this code 331 // ReadMultiple takes a non-const array of PROPVARIANTs, but since this code
332 // only needs an array of size 1: a non-const pointer to |output| is 332 // only needs an array of size 1: a non-const pointer to |output| is
333 // equivalent. 333 // equivalent.
334 base::win::ScopedPropVariant output; 334 base::win::ScopedPropVariant output;
335 // ReadMultiple can return S_FALSE (FAILED(S_FALSE) is false) when the 335 // ReadMultiple can return S_FALSE (FAILED(S_FALSE) is false) when the
336 // property is not found, in which case output[0].vt is set to VT_EMPTY. 336 // property is not found, in which case output[0].vt is set to VT_EMPTY.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 url::kFtpScheme, 506 url::kFtpScheme,
507 url::kFileScheme}; 507 url::kFileScheme};
508 int total_schemes = arraysize(kSchemes); 508 int total_schemes = arraysize(kSchemes);
509 509
510 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; 510 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
511 if (FAILED(url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL, 511 if (FAILED(url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
512 CLSCTX_INPROC_SERVER))) { 512 CLSCTX_INPROC_SERVER))) {
513 return; 513 return;
514 } 514 }
515 base::win::ScopedComPtr<IEnumSTATURL> enum_url; 515 base::win::ScopedComPtr<IEnumSTATURL> enum_url;
516 if (SUCCEEDED(url_history_stg2->EnumUrls(enum_url.Receive()))) { 516 if (SUCCEEDED(url_history_stg2->EnumUrls(enum_url.GetAddressOf()))) {
517 std::vector<ImporterURLRow> rows; 517 std::vector<ImporterURLRow> rows;
518 STATURL stat_url; 518 STATURL stat_url;
519 519
520 // IEnumSTATURL::Next() doesn't fill STATURL::dwFlags by default. Need to 520 // IEnumSTATURL::Next() doesn't fill STATURL::dwFlags by default. Need to
521 // call IEnumSTATURL::SetFilter() with STATURL_QUERYFLAG_TOPLEVEL flag to 521 // call IEnumSTATURL::SetFilter() with STATURL_QUERYFLAG_TOPLEVEL flag to
522 // specify how STATURL structure will be filled. 522 // specify how STATURL structure will be filled.
523 // The first argument of IEnumSTATURL::SetFilter() specifies the URL prefix 523 // The first argument of IEnumSTATURL::SetFilter() specifies the URL prefix
524 // that is used by IEnumSTATURL::Next() for filtering items by URL. 524 // that is used by IEnumSTATURL::Next() for filtering items by URL.
525 // So need to pass an empty string here to get all history items. 525 // So need to pass an empty string here to get all history items.
526 enum_url->SetFilter(L"", STATURL_QUERYFLAG_TOPLEVEL); 526 enum_url->SetFilter(L"", STATURL_QUERYFLAG_TOPLEVEL);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (!pstorec_dll) 582 if (!pstorec_dll)
583 return; 583 return;
584 PStoreCreateFunc PStoreCreateInstance = 584 PStoreCreateFunc PStoreCreateInstance =
585 (PStoreCreateFunc)GetProcAddress(pstorec_dll, "PStoreCreateInstance"); 585 (PStoreCreateFunc)GetProcAddress(pstorec_dll, "PStoreCreateInstance");
586 if (!PStoreCreateInstance) { 586 if (!PStoreCreateInstance) {
587 FreeLibrary(pstorec_dll); 587 FreeLibrary(pstorec_dll);
588 return; 588 return;
589 } 589 }
590 590
591 base::win::ScopedComPtr<IPStore, &IID_IPStore> pstore; 591 base::win::ScopedComPtr<IPStore, &IID_IPStore> pstore;
592 HRESULT result = PStoreCreateInstance(pstore.Receive(), 0, 0, 0); 592 HRESULT result = PStoreCreateInstance(pstore.GetAddressOf(), 0, 0, 0);
593 if (result != S_OK) { 593 if (result != S_OK) {
594 FreeLibrary(pstorec_dll); 594 FreeLibrary(pstorec_dll);
595 return; 595 return;
596 } 596 }
597 597
598 std::vector<AutoCompleteInfo> ac_list; 598 std::vector<AutoCompleteInfo> ac_list;
599 599
600 // Enumerates AutoComplete items in the protected database. 600 // Enumerates AutoComplete items in the protected database.
601 base::win::ScopedComPtr<IEnumPStoreItems, &IID_IEnumPStoreItems> item; 601 base::win::ScopedComPtr<IEnumPStoreItems, &IID_IEnumPStoreItems> item;
602 result = pstore->EnumItems(0, &AutocompleteGUID, 602 result = pstore->EnumItems(0, &AutocompleteGUID, &AutocompleteGUID, 0,
603 &AutocompleteGUID, 0, item.Receive()); 603 item.GetAddressOf());
604 if (result != PST_E_OK) { 604 if (result != PST_E_OK) {
605 pstore.Reset(); 605 pstore.Reset();
606 FreeLibrary(pstorec_dll); 606 FreeLibrary(pstorec_dll);
607 return; 607 return;
608 } 608 }
609 609
610 wchar_t* item_name; 610 wchar_t* item_name;
611 while (!cancelled() && SUCCEEDED(item->Next(1, &item_name, 0))) { 611 while (!cancelled() && SUCCEEDED(item->Next(1, &item_name, 0))) {
612 DWORD length = 0; 612 DWORD length = 0;
613 unsigned char* buffer = NULL; 613 unsigned char* buffer = NULL;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 static int version = -1; 911 static int version = -1;
912 if (version < 0) { 912 if (version < 0) {
913 wchar_t buffer[128]; 913 wchar_t buffer[128];
914 DWORD buffer_length = sizeof(buffer); 914 DWORD buffer_length = sizeof(buffer);
915 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 915 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
916 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 916 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
917 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 917 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
918 } 918 }
919 return version; 919 return version;
920 } 920 }
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_win.cc ('k') | chrome/utility/shell_handler_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698