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

Unified Diff: chrome/utility/importer/ie_importer_win.cc

Issue 800433002: Search for history items that was imported from IE is not working. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some issues/comments found by Gab@ Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/ie_importer_browsertest_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/importer/ie_importer_win.cc
diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc
index 4865397260acaac1ecee67f5f757ed012bcac32a..3109576a337c69a4da61aa46431fe893d94206d7 100644
--- a/chrome/utility/importer/ie_importer_win.cc
+++ b/chrome/utility/importer/ie_importer_win.cc
@@ -477,18 +477,24 @@ void IEImporter::ImportHistory() {
int total_schemes = arraysize(kSchemes);
base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
- HRESULT result;
- result = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
- CLSCTX_INPROC_SERVER);
- if (FAILED(result))
+ if (FAILED(url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
+ CLSCTX_INPROC_SERVER))) {
return;
+ }
base::win::ScopedComPtr<IEnumSTATURL> enum_url;
- if (SUCCEEDED(result = url_history_stg2->EnumUrls(enum_url.Receive()))) {
+ if (SUCCEEDED(url_history_stg2->EnumUrls(enum_url.Receive()))) {
std::vector<ImporterURLRow> rows;
STATURL stat_url;
- ULONG fetched;
+
+ // IEnumSTATURL::Next() doesn't fill STATURL::dwFlags by default. Need to
+ // call IEnumSTATURL::SetFilter() with STATURL_QUERYFLAG_TOPLEVEL flag to
+ // specify how STATURL structure will be filled.
+ // The first argument of IEnumSTATURL::SetFilter() specifies the URL prefix
+ // that is used by IEnumSTATURL::Next() for filtering items by URL.
+ // So need to pass an empty string here to get all history items.
+ enum_url->SetFilter(L"", STATURL_QUERYFLAG_TOPLEVEL);
while (!cancelled() &&
- (result = enum_url->Next(1, &stat_url, &fetched)) == S_OK) {
+ enum_url->Next(1, &stat_url, NULL) == S_OK) {
base::string16 url_string;
if (stat_url.pwcsUrl) {
url_string = stat_url.pwcsUrl;
@@ -510,10 +516,13 @@ void IEImporter::ImportHistory() {
ImporterURLRow row(url);
row.title = title_string;
row.last_visit = base::Time::FromFileTime(stat_url.ftLastVisited);
- if (stat_url.dwFlags == STATURL_QUERYFLAG_TOPLEVEL) {
+ if (stat_url.dwFlags == STATURLFLAG_ISTOPLEVEL) {
row.visit_count = 1;
row.hidden = false;
} else {
+ // dwFlags should only contain the STATURLFLAG_ISTOPLEVEL bit per
+ // the filter set above.
+ DCHECK(!stat_url.dwFlags);
row.hidden = true;
}
« no previous file with comments | « chrome/browser/importer/ie_importer_browsertest_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698