| OLD | NEW |
| 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 <urlhist.h> | 10 #include <urlhist.h> |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 item.Release(); | 606 item.Release(); |
| 607 pstore.Release(); | 607 pstore.Release(); |
| 608 FreeLibrary(pstorec_dll); | 608 FreeLibrary(pstorec_dll); |
| 609 | 609 |
| 610 size_t i; | 610 size_t i; |
| 611 for (i = 0; i < ac_list.size(); i++) { | 611 for (i = 0; i < ac_list.size(); i++) { |
| 612 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) | 612 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) |
| 613 continue; | 613 continue; |
| 614 | 614 |
| 615 GURL url(ac_list[i].key.c_str()); | 615 GURL url(ac_list[i].key.c_str()); |
| 616 if (!(LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || | 616 if (!(base::LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || |
| 617 LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { | 617 base::LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { |
| 618 continue; | 618 continue; |
| 619 } | 619 } |
| 620 | 620 |
| 621 autofill::PasswordForm form; | 621 autofill::PasswordForm form; |
| 622 GURL::Replacements rp; | 622 GURL::Replacements rp; |
| 623 rp.ClearUsername(); | 623 rp.ClearUsername(); |
| 624 rp.ClearPassword(); | 624 rp.ClearPassword(); |
| 625 rp.ClearQuery(); | 625 rp.ClearQuery(); |
| 626 rp.ClearRef(); | 626 rp.ClearRef(); |
| 627 form.origin = url.ReplaceComponents(rp); | 627 form.origin = url.ReplaceComponents(rp); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 std::sort(file_list.begin(), file_list.end()); | 816 std::sort(file_list.begin(), file_list.end()); |
| 817 | 817 |
| 818 // Map from favicon URLs to the favicon data (the binary image data and the | 818 // Map from favicon URLs to the favicon data (the binary image data and the |
| 819 // set of bookmark URLs referring to the favicon). | 819 // set of bookmark URLs referring to the favicon). |
| 820 typedef std::map<GURL, favicon_base::FaviconUsageData> FaviconMap; | 820 typedef std::map<GURL, favicon_base::FaviconUsageData> FaviconMap; |
| 821 FaviconMap favicon_map; | 821 FaviconMap favicon_map; |
| 822 | 822 |
| 823 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); | 823 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); |
| 824 it != file_list.end(); ++it) { | 824 it != file_list.end(); ++it) { |
| 825 base::FilePath shortcut(*it); | 825 base::FilePath shortcut(*it); |
| 826 if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url")) | 826 if (!base::LowerCaseEqualsASCII(shortcut.Extension(), ".url")) |
| 827 continue; | 827 continue; |
| 828 | 828 |
| 829 // Skip the bookmark with invalid URL. | 829 // Skip the bookmark with invalid URL. |
| 830 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; | 830 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; |
| 831 if (!LoadInternetShortcut(*it, &url_locator)) | 831 if (!LoadInternetShortcut(*it, &url_locator)) |
| 832 continue; | 832 continue; |
| 833 GURL url = ReadURLFromInternetShortcut(url_locator.get()); | 833 GURL url = ReadURLFromInternetShortcut(url_locator.get()); |
| 834 if (!url.is_valid()) | 834 if (!url.is_valid()) |
| 835 continue; | 835 continue; |
| 836 // Skip default bookmarks. go.microsoft.com redirects to | 836 // Skip default bookmarks. go.microsoft.com redirects to |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 static int version = -1; | 883 static int version = -1; |
| 884 if (version < 0) { | 884 if (version < 0) { |
| 885 wchar_t buffer[128]; | 885 wchar_t buffer[128]; |
| 886 DWORD buffer_length = sizeof(buffer); | 886 DWORD buffer_length = sizeof(buffer); |
| 887 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 887 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
| 888 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 888 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
| 889 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 889 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
| 890 } | 890 } |
| 891 return version; | 891 return version; |
| 892 } | 892 } |
| OLD | NEW |