| 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> |
| 11 #include <urlhist.h> | 11 #include <urlhist.h> |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <map> | 14 #include <map> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "app/l10n_util.h" | 18 #include "app/l10n_util.h" |
| 19 #include "app/win_util.h" | 19 #include "app/win_util.h" |
| 20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
| 21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 22 #include "base/registry.h" | 22 #include "base/registry.h" |
| 23 #include "base/scoped_comptr_win.h" | 23 #include "base/scoped_comptr_win.h" |
| 24 #include "base/string_split.h" | 24 #include "base/string_split.h" |
| 25 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 26 #include "base/time.h" | 26 #include "base/time.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
| 29 #include "base/win_util.h" | 29 #include "base/win/windows_version.h" |
| 30 #include "chrome/browser/bookmarks/bookmark_model.h" | 30 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 31 #include "chrome/browser/importer/importer_bridge.h" | 31 #include "chrome/browser/importer/importer_bridge.h" |
| 32 #include "chrome/browser/importer/importer_data_types.h" | 32 #include "chrome/browser/importer/importer_data_types.h" |
| 33 #include "chrome/browser/password_manager/ie7_password.h" | 33 #include "chrome/browser/password_manager/ie7_password.h" |
| 34 #include "chrome/browser/search_engines/template_url.h" | 34 #include "chrome/browser/search_engines/template_url.h" |
| 35 #include "chrome/browser/search_engines/template_url_model.h" | 35 #include "chrome/browser/search_engines/template_url_model.h" |
| 36 #include "chrome/common/time_format.h" | 36 #include "chrome/common/time_format.h" |
| 37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "googleurl/src/gurl.h" | 38 #include "googleurl/src/gurl.h" |
| 39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 wchar_t buffer[MAX_PATH]; | 456 wchar_t buffer[MAX_PATH]; |
| 457 if (FAILED(SHGetFolderPath(NULL, CSIDL_FAVORITES, NULL, | 457 if (FAILED(SHGetFolderPath(NULL, CSIDL_FAVORITES, NULL, |
| 458 SHGFP_TYPE_CURRENT, buffer))) | 458 SHGFP_TYPE_CURRENT, buffer))) |
| 459 return false; | 459 return false; |
| 460 info->path = buffer; | 460 info->path = buffer; |
| 461 | 461 |
| 462 // There is a Links folder under Favorites folder in Windows Vista, but it | 462 // There is a Links folder under Favorites folder in Windows Vista, but it |
| 463 // is not recording in Vista's registry. So in Vista, we assume the Links | 463 // is not recording in Vista's registry. So in Vista, we assume the Links |
| 464 // folder is under Favorites folder since it looks like there is not name | 464 // folder is under Favorites folder since it looks like there is not name |
| 465 // different in every language version of Windows Vista. | 465 // different in every language version of Windows Vista. |
| 466 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 466 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 467 // The Link folder name is stored in the registry. | 467 // The Link folder name is stored in the registry. |
| 468 DWORD buffer_length = sizeof(buffer); | 468 DWORD buffer_length = sizeof(buffer); |
| 469 RegKey reg_key(HKEY_CURRENT_USER, | 469 RegKey reg_key(HKEY_CURRENT_USER, |
| 470 L"Software\\Microsoft\\Internet Explorer\\Toolbar", | 470 L"Software\\Microsoft\\Internet Explorer\\Toolbar", |
| 471 KEY_READ); | 471 KEY_READ); |
| 472 if (!reg_key.ReadValue(L"LinksFolderName", buffer, &buffer_length, NULL)) | 472 if (!reg_key.ReadValue(L"LinksFolderName", buffer, &buffer_length, NULL)) |
| 473 return false; | 473 return false; |
| 474 info->links_folder = buffer; | 474 info->links_folder = buffer; |
| 475 } else { | 475 } else { |
| 476 info->links_folder = L"Links"; | 476 info->links_folder = L"Links"; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 if (version < 0) { | 576 if (version < 0) { |
| 577 wchar_t buffer[128]; | 577 wchar_t buffer[128]; |
| 578 DWORD buffer_length = sizeof(buffer); | 578 DWORD buffer_length = sizeof(buffer); |
| 579 RegKey reg_key(HKEY_LOCAL_MACHINE, | 579 RegKey reg_key(HKEY_LOCAL_MACHINE, |
| 580 L"Software\\Microsoft\\Internet Explorer", KEY_READ); | 580 L"Software\\Microsoft\\Internet Explorer", KEY_READ); |
| 581 bool result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 581 bool result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
| 582 version = (result ? _wtoi(buffer) : 0); | 582 version = (result ? _wtoi(buffer) : 0); |
| 583 } | 583 } |
| 584 return version; | 584 return version; |
| 585 } | 585 } |
| OLD | NEW |