| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/importer/ie_importer.h" | 5 #include "chrome/browser/importer/ie_importer.h" |
| 6 | 6 |
| 7 #include <ole2.h> | 7 #include <ole2.h> |
| 8 #include <intshcut.h> | 8 #include <intshcut.h> |
| 9 #include <pstore.h> | 9 #include <pstore.h> |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 return false; | 452 return false; |
| 453 info->path = buffer; | 453 info->path = buffer; |
| 454 | 454 |
| 455 // There is a Links folder under Favorites folder in Windows Vista, but it | 455 // There is a Links folder under Favorites folder in Windows Vista, but it |
| 456 // is not recording in Vista's registry. So in Vista, we assume the Links | 456 // is not recording in Vista's registry. So in Vista, we assume the Links |
| 457 // folder is under Favorites folder since it looks like there is not name | 457 // folder is under Favorites folder since it looks like there is not name |
| 458 // different in every language version of Windows Vista. | 458 // different in every language version of Windows Vista. |
| 459 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 459 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { |
| 460 // The Link folder name is stored in the registry. | 460 // The Link folder name is stored in the registry. |
| 461 DWORD buffer_length = sizeof(buffer); | 461 DWORD buffer_length = sizeof(buffer); |
| 462 if (!ReadFromRegistry(HKEY_CURRENT_USER, | 462 RegKey reg_key(HKEY_CURRENT_USER, |
| 463 L"Software\\Microsoft\\Internet Explorer\\Toolbar", | 463 L"Software\\Microsoft\\Internet Explorer\\Toolbar"); |
| 464 L"LinksFolderName", buffer, &buffer_length)) | 464 if (reg_key.ReadValue(L"LinksFolderName", buffer, &buffer_length, NULL)) |
| 465 return false; | 465 return false; |
| 466 info->links_folder = buffer; | 466 info->links_folder = buffer; |
| 467 } else { | 467 } else { |
| 468 info->links_folder = L"Links"; | 468 info->links_folder = L"Links"; |
| 469 } | 469 } |
| 470 | 470 |
| 471 return true; | 471 return true; |
| 472 } | 472 } |
| 473 | 473 |
| 474 void IEImporter::ParseFavoritesFolder(const FavoritesInfo& info, | 474 void IEImporter::ParseFavoritesFolder(const FavoritesInfo& info, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 return std::wstring(); | 561 return std::wstring(); |
| 562 | 562 |
| 563 return std::wstring(url); | 563 return std::wstring(url); |
| 564 } | 564 } |
| 565 | 565 |
| 566 int IEImporter::CurrentIEVersion() const { | 566 int IEImporter::CurrentIEVersion() const { |
| 567 static int version = -1; | 567 static int version = -1; |
| 568 if (version < 0) { | 568 if (version < 0) { |
| 569 wchar_t buffer[128]; | 569 wchar_t buffer[128]; |
| 570 DWORD buffer_length = sizeof(buffer); | 570 DWORD buffer_length = sizeof(buffer); |
| 571 bool result = ReadFromRegistry(HKEY_LOCAL_MACHINE, | 571 RegKey reg_key(HKEY_LOCAL_MACHINE, |
| 572 L"Software\\Microsoft\\Internet Explorer", | 572 L"Software\\Microsoft\\Internet Explorer"); |
| 573 L"Version", buffer, &buffer_length); | 573 bool result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
| 574 version = (result ? _wtoi(buffer) : 0); | 574 version = (result ? _wtoi(buffer) : 0); |
| 575 } | 575 } |
| 576 return version; | 576 return version; |
| 577 } | 577 } |
| OLD | NEW |