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/firefox2_importer.h" | 5 #include "chrome/browser/importer/firefox2_importer.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/registry.h" | 9 #include "base/registry.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 ReplaceSubstringsAfterOffset(text, 0, L">", L">"); | 501 ReplaceSubstringsAfterOffset(text, 0, L">", L">"); |
502 ReplaceSubstringsAfterOffset(text, 0, L"&", L"&"); | 502 ReplaceSubstringsAfterOffset(text, 0, L"&", L"&"); |
503 ReplaceSubstringsAfterOffset(text, 0, L""", L"\""); | 503 ReplaceSubstringsAfterOffset(text, 0, L""", L"\""); |
504 ReplaceSubstringsAfterOffset(text, 0, L"'", L"\'"); | 504 ReplaceSubstringsAfterOffset(text, 0, L"'", L"\'"); |
505 } | 505 } |
506 | 506 |
507 // static | 507 // static |
508 void Firefox2Importer::FindXMLFilesInDir( | 508 void Firefox2Importer::FindXMLFilesInDir( |
509 const std::wstring& dir, | 509 const std::wstring& dir, |
510 std::vector<std::wstring>* xml_files) { | 510 std::vector<std::wstring>* xml_files) { |
511 file_util::FileEnumerator file_enum(dir, false, | 511 file_util::FileEnumerator file_enum(FilePath::FromWStringHack(dir), false, |
512 file_util::FileEnumerator::FILES, | 512 file_util::FileEnumerator::FILES, |
513 L"*.xml"); | 513 FILE_PATH_LITERAL("*.xml")); |
514 std::wstring file(file_enum.Next()); | 514 std::wstring file(file_enum.Next().ToWStringHack()); |
515 while (!file.empty()) { | 515 while (!file.empty()) { |
516 xml_files->push_back(file); | 516 xml_files->push_back(file); |
517 file = file_enum.Next(); | 517 file = file_enum.Next().ToWStringHack(); |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 // static | 521 // static |
522 void Firefox2Importer::DataURLToFaviconUsage( | 522 void Firefox2Importer::DataURLToFaviconUsage( |
523 const GURL& link_url, | 523 const GURL& link_url, |
524 const GURL& favicon_data, | 524 const GURL& favicon_data, |
525 std::vector<history::ImportedFavIconUsage>* favicons) { | 525 std::vector<history::ImportedFavIconUsage>* favicons) { |
526 if (!link_url.is_valid() || !favicon_data.is_valid() || | 526 if (!link_url.is_valid() || !favicon_data.is_valid() || |
527 !favicon_data.SchemeIs("data")) | 527 !favicon_data.SchemeIs("data")) |
(...skipping 12 matching lines...) Expand all Loading... |
540 | 540 |
541 // We need to make up a URL for the favicon. We use a version of the page's | 541 // We need to make up a URL for the favicon. We use a version of the page's |
542 // URL so that we can be sure it will not collide. | 542 // URL so that we can be sure it will not collide. |
543 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 543 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
544 | 544 |
545 // We only have one URL per favicon for Firefox 2 bookmarks. | 545 // We only have one URL per favicon for Firefox 2 bookmarks. |
546 usage.urls.insert(link_url); | 546 usage.urls.insert(link_url); |
547 | 547 |
548 favicons->push_back(usage); | 548 favicons->push_back(usage); |
549 } | 549 } |
OLD | NEW |