| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 603 &AutocompleteGUID, 0, item.Receive()); | 603 &AutocompleteGUID, 0, item.Receive()); |
| 604 if (result != PST_E_OK) { | 604 if (result != PST_E_OK) { |
| 605 pstore.Release(); | 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; |
| 614 result = pstore->ReadItem(0, &AutocompleteGUID, &AutocompleteGUID, | 614 result = pstore->ReadItem(0, &AutocompleteGUID, &AutocompleteGUID, |
| 615 item_name, &length, &buffer, NULL, 0); | 615 item_name, &length, &buffer, NULL, 0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 629 ac_list.push_back(ac); | 629 ac_list.push_back(ac); |
| 630 ac_list.back().data = | 630 ac_list.back().data = |
| 631 base::SplitString(data, base::string16(1, '\0'), | 631 base::SplitString(data, base::string16(1, '\0'), |
| 632 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 632 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 633 } | 633 } |
| 634 CoTaskMemFree(buffer); | 634 CoTaskMemFree(buffer); |
| 635 } | 635 } |
| 636 CoTaskMemFree(item_name); | 636 CoTaskMemFree(item_name); |
| 637 } | 637 } |
| 638 // Releases them before unload the dll. | 638 // Releases them before unload the dll. |
| 639 item.Release(); | 639 item.Reset(); |
| 640 pstore.Release(); | 640 pstore.Reset(); |
| 641 FreeLibrary(pstorec_dll); | 641 FreeLibrary(pstorec_dll); |
| 642 | 642 |
| 643 size_t i; | 643 size_t i; |
| 644 for (i = 0; i < ac_list.size(); i++) { | 644 for (i = 0; i < ac_list.size(); i++) { |
| 645 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) | 645 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) |
| 646 continue; | 646 continue; |
| 647 | 647 |
| 648 GURL url(ac_list[i].key.c_str()); | 648 GURL url(ac_list[i].key.c_str()); |
| 649 if (!(base::LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || | 649 if (!(base::LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || |
| 650 base::LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { | 650 base::LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |