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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 NotifyItemStarted(HISTORY); | 68 NotifyItemStarted(HISTORY); |
69 ImportHistory(); | 69 ImportHistory(); |
70 NotifyItemEnded(HISTORY); | 70 NotifyItemEnded(HISTORY); |
71 } | 71 } |
72 NotifyEnded(); | 72 NotifyEnded(); |
73 } | 73 } |
74 | 74 |
75 // static | 75 // static |
76 void Firefox2Importer::LoadDefaultBookmarks(const std::wstring& app_path, | 76 void Firefox2Importer::LoadDefaultBookmarks(const std::wstring& app_path, |
77 std::set<GURL> *urls) { | 77 std::set<GURL> *urls) { |
78 // TODO(port): Code below is correct only on Windows. | |
79 // Firefox keeps its default bookmarks in a bookmarks.html file that | |
80 // lives at: <Firefox install dir>\defaults\profile\bookmarks.html | |
81 FilePath file = FilePath::FromWStringHack(app_path); | 78 FilePath file = FilePath::FromWStringHack(app_path); |
82 file.AppendASCII("defaults"); | 79 file = file.AppendASCII("defaults"); |
83 file.AppendASCII("profile"); | 80 file = file.AppendASCII("profile"); |
84 file.AppendASCII("bookmarks.html"); | 81 file = file.AppendASCII("bookmarks.html"); |
85 | 82 |
86 urls->clear(); | 83 urls->clear(); |
87 | 84 |
88 // Read the whole file. | 85 // Read the whole file. |
89 std::string content; | 86 std::string content; |
90 file_util::ReadFileToString(file.ToWStringHack(), &content); | 87 file_util::ReadFileToString(file.ToWStringHack(), &content); |
91 std::vector<std::string> lines; | 88 std::vector<std::string> lines; |
92 SplitString(content, '\n', &lines); | 89 SplitString(content, '\n', &lines); |
93 | 90 |
94 std::string charset; | 91 std::string charset; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 567 |
571 // We need to make up a URL for the favicon. We use a version of the page's | 568 // We need to make up a URL for the favicon. We use a version of the page's |
572 // URL so that we can be sure it will not collide. | 569 // URL so that we can be sure it will not collide. |
573 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 570 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
574 | 571 |
575 // We only have one URL per favicon for Firefox 2 bookmarks. | 572 // We only have one URL per favicon for Firefox 2 bookmarks. |
576 usage.urls.insert(link_url); | 573 usage.urls.insert(link_url); |
577 | 574 |
578 favicons->push_back(usage); | 575 favicons->push_back(usage); |
579 } | 576 } |
OLD | NEW |