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_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 NotifyEnded(); | 66 NotifyEnded(); |
67 } | 67 } |
68 | 68 |
69 // static | 69 // static |
70 void Firefox2Importer::LoadDefaultBookmarks(const std::wstring& app_path, | 70 void Firefox2Importer::LoadDefaultBookmarks(const std::wstring& app_path, |
71 std::set<GURL> *urls) { | 71 std::set<GURL> *urls) { |
72 // TODO(port): Code below is correct only on Windows. | 72 // TODO(port): Code below is correct only on Windows. |
73 // Firefox keeps its default bookmarks in a bookmarks.html file that | 73 // Firefox keeps its default bookmarks in a bookmarks.html file that |
74 // lives at: <Firefox install dir>\defaults\profile\bookmarks.html | 74 // lives at: <Firefox install dir>\defaults\profile\bookmarks.html |
75 FilePath file = FilePath::FromWStringHack(app_path); | 75 FilePath file = FilePath::FromWStringHack(app_path); |
76 file.Append(FILE_PATH_LITERAL("defaults")); | 76 file.AppendASCII("defaults"); |
77 file.Append(FILE_PATH_LITERAL("profile")); | 77 file.AppendASCII("profile"); |
78 file.Append(FILE_PATH_LITERAL("bookmarks.html")); | 78 file.AppendASCII("bookmarks.html"); |
79 | 79 |
80 urls->clear(); | 80 urls->clear(); |
81 | 81 |
82 // Read the whole file. | 82 // Read the whole file. |
83 std::string content; | 83 std::string content; |
84 file_util::ReadFileToString(file.ToWStringHack(), &content); | 84 file_util::ReadFileToString(file.ToWStringHack(), &content); |
85 std::vector<std::string> lines; | 85 std::vector<std::string> lines; |
86 SplitString(content, '\n', &lines); | 86 SplitString(content, '\n', &lines); |
87 | 87 |
88 std::string charset; | 88 std::string charset; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 543 |
544 // We need to make up a URL for the favicon. We use a version of the page's | 544 // We need to make up a URL for the favicon. We use a version of the page's |
545 // URL so that we can be sure it will not collide. | 545 // URL so that we can be sure it will not collide. |
546 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 546 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
547 | 547 |
548 // We only have one URL per favicon for Firefox 2 bookmarks. | 548 // We only have one URL per favicon for Firefox 2 bookmarks. |
549 usage.urls.insert(link_url); | 549 usage.urls.insert(link_url); |
550 | 550 |
551 favicons->push_back(usage); | 551 favicons->push_back(usage); |
552 } | 552 } |
OLD | NEW |