OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <atlbase.h> | 7 #include <atlbase.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 | 14 |
15 #include "app/l10n_util.h" | 15 #include "app/l10n_util.h" |
16 #include "app/win_util.h" | 16 #include "app/win_util.h" |
| 17 #include "base/file_path.h" |
17 #include "base/file_util.h" | 18 #include "base/file_util.h" |
18 #include "base/registry.h" | 19 #include "base/registry.h" |
19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
20 #include "base/time.h" | 21 #include "base/time.h" |
21 #include "base/win_util.h" | 22 #include "base/win_util.h" |
22 #include "chrome/browser/bookmarks/bookmark_model.h" | 23 #include "chrome/browser/bookmarks/bookmark_model.h" |
23 #include "chrome/browser/password_manager/ie7_password.h" | 24 #include "chrome/browser/password_manager/ie7_password.h" |
24 #include "chrome/browser/search_engines/template_url_model.h" | 25 #include "chrome/browser/search_engines/template_url_model.h" |
25 #include "chrome/common/time_format.h" | 26 #include "chrome/common/time_format.h" |
26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (relative_string.size() > 0 && FilePath::IsSeparator(relative_string[0])) | 510 if (relative_string.size() > 0 && FilePath::IsSeparator(relative_string[0])) |
510 relative_string = relative_string.substr(1); | 511 relative_string = relative_string.substr(1); |
511 FilePath relative_path(relative_string); | 512 FilePath relative_path(relative_string); |
512 | 513 |
513 ProfileWriter::BookmarkEntry entry; | 514 ProfileWriter::BookmarkEntry entry; |
514 // Remove the dot, the file extension, and the directory path. | 515 // Remove the dot, the file extension, and the directory path. |
515 entry.title = shortcut.RemoveExtension().BaseName().value(); | 516 entry.title = shortcut.RemoveExtension().BaseName().value(); |
516 entry.url = url; | 517 entry.url = url; |
517 entry.creation_time = GetFileCreationTime(*it); | 518 entry.creation_time = GetFileCreationTime(*it); |
518 if (!relative_path.empty()) | 519 if (!relative_path.empty()) |
519 file_util::PathComponents(relative_path, &entry.path); | 520 relative_path.GetComponents(&entry.path); |
520 | 521 |
521 // Flatten the bookmarks in Link folder onto bookmark toolbar. Otherwise, | 522 // Flatten the bookmarks in Link folder onto bookmark toolbar. Otherwise, |
522 // put it into "Other bookmarks". | 523 // put it into "Other bookmarks". |
523 if (import_to_bookmark_bar() && | 524 if (import_to_bookmark_bar() && |
524 (entry.path.size() > 0 && entry.path[0] == info.links_folder)) { | 525 (entry.path.size() > 0 && entry.path[0] == info.links_folder)) { |
525 entry.in_toolbar = true; | 526 entry.in_toolbar = true; |
526 entry.path.erase(entry.path.begin()); | 527 entry.path.erase(entry.path.begin()); |
527 toolbar_bookmarks.push_back(entry); | 528 toolbar_bookmarks.push_back(entry); |
528 } else { | 529 } else { |
529 // We put the bookmarks in a "Imported From IE" | 530 // We put the bookmarks in a "Imported From IE" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 if (version < 0) { | 569 if (version < 0) { |
569 wchar_t buffer[128]; | 570 wchar_t buffer[128]; |
570 DWORD buffer_length = sizeof(buffer); | 571 DWORD buffer_length = sizeof(buffer); |
571 bool result = ReadFromRegistry(HKEY_LOCAL_MACHINE, | 572 bool result = ReadFromRegistry(HKEY_LOCAL_MACHINE, |
572 L"Software\\Microsoft\\Internet Explorer", | 573 L"Software\\Microsoft\\Internet Explorer", |
573 L"Version", buffer, &buffer_length); | 574 L"Version", buffer, &buffer_length); |
574 version = (result ? _wtoi(buffer) : 0); | 575 version = (result ? _wtoi(buffer) : 0); |
575 } | 576 } |
576 return version; | 577 return version; |
577 } | 578 } |
OLD | NEW |