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

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: Removed redundant flag from SetFilter call. 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
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..fa57e55396436e0030e49fe623e485bea55cd51c 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 that STATURL::dwFlags will indicate whether this URL is dated
gab 2014/12/23 22:00:58 I prefered your previous wording, e.g. something l
Alexey Seren 2014/12/24 07:23:19 Acknowledged. Changed to previous comment.
+ // (top level). 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,11 @@ 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 {
+ DCHECK(!stat_url.dwFlags);
gab 2014/12/23 22:00:58 As in code provided in previous comment, add this
Alexey Seren 2014/12/24 07:23:19 Acknowledged.
row.hidden = true;
}

Powered by Google App Engine
This is Rietveld 408576698