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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 item.Release(); | 595 item.Release(); |
596 pstore.Release(); | 596 pstore.Release(); |
597 FreeLibrary(pstorec_dll); | 597 FreeLibrary(pstorec_dll); |
598 | 598 |
599 size_t i; | 599 size_t i; |
600 for (i = 0; i < ac_list.size(); i++) { | 600 for (i = 0; i < ac_list.size(); i++) { |
601 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) | 601 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) |
602 continue; | 602 continue; |
603 | 603 |
604 GURL url(ac_list[i].key.c_str()); | 604 GURL url(ac_list[i].key.c_str()); |
605 if (!(base::LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || | 605 if (!(LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || |
606 base::LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { | 606 LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { |
607 continue; | 607 continue; |
608 } | 608 } |
609 | 609 |
610 autofill::PasswordForm form; | 610 autofill::PasswordForm form; |
611 GURL::Replacements rp; | 611 GURL::Replacements rp; |
612 rp.ClearUsername(); | 612 rp.ClearUsername(); |
613 rp.ClearPassword(); | 613 rp.ClearPassword(); |
614 rp.ClearQuery(); | 614 rp.ClearQuery(); |
615 rp.ClearRef(); | 615 rp.ClearRef(); |
616 form.origin = url.ReplaceComponents(rp); | 616 form.origin = url.ReplaceComponents(rp); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 std::sort(file_list.begin(), file_list.end()); | 805 std::sort(file_list.begin(), file_list.end()); |
806 | 806 |
807 // Map from favicon URLs to the favicon data (the binary image data and the | 807 // Map from favicon URLs to the favicon data (the binary image data and the |
808 // set of bookmark URLs referring to the favicon). | 808 // set of bookmark URLs referring to the favicon). |
809 typedef std::map<GURL, ImportedFaviconUsage> FaviconMap; | 809 typedef std::map<GURL, ImportedFaviconUsage> FaviconMap; |
810 FaviconMap favicon_map; | 810 FaviconMap favicon_map; |
811 | 811 |
812 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); | 812 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); |
813 it != file_list.end(); ++it) { | 813 it != file_list.end(); ++it) { |
814 base::FilePath shortcut(*it); | 814 base::FilePath shortcut(*it); |
815 if (!base::LowerCaseEqualsASCII(shortcut.Extension(), ".url")) | 815 if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url")) |
816 continue; | 816 continue; |
817 | 817 |
818 // Skip the bookmark with invalid URL. | 818 // Skip the bookmark with invalid URL. |
819 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; | 819 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; |
820 if (!LoadInternetShortcut(*it, &url_locator)) | 820 if (!LoadInternetShortcut(*it, &url_locator)) |
821 continue; | 821 continue; |
822 GURL url = ReadURLFromInternetShortcut(url_locator); | 822 GURL url = ReadURLFromInternetShortcut(url_locator); |
823 if (!url.is_valid()) | 823 if (!url.is_valid()) |
824 continue; | 824 continue; |
825 // Skip default bookmarks. go.microsoft.com redirects to | 825 // Skip default bookmarks. go.microsoft.com redirects to |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 static int version = -1; | 872 static int version = -1; |
873 if (version < 0) { | 873 if (version < 0) { |
874 wchar_t buffer[128]; | 874 wchar_t buffer[128]; |
875 DWORD buffer_length = sizeof(buffer); | 875 DWORD buffer_length = sizeof(buffer); |
876 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 876 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
877 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 877 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
878 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 878 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
879 } | 879 } |
880 return version; | 880 return version; |
881 } | 881 } |
OLD | NEW |