OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/importer/importer_util.h" | 23 #include "chrome/browser/importer/importer_util.h" |
24 #include "chrome/browser/importer/mork_reader.h" | 24 #include "chrome/browser/importer/mork_reader.h" |
25 #include "chrome/browser/importer/nss_decryptor.h" | 25 #include "chrome/browser/importer/nss_decryptor.h" |
26 #include "chrome/browser/search_engines/template_url.h" | 26 #include "chrome/browser/search_engines/template_url.h" |
27 #include "chrome/browser/search_engines/template_url_parser.h" | 27 #include "chrome/browser/search_engines/template_url_parser.h" |
28 #include "chrome/common/time_format.h" | 28 #include "chrome/common/time_format.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
32 #include "net/base/data_url.h" | 32 #include "net/base/data_url.h" |
33 #include "webkit/glue/password_form.h" | 33 #include "webkit/forms/password_form.h" |
34 | 34 |
35 namespace { | 35 namespace { |
36 const char kItemOpen[] = "<DT><A"; | 36 const char kItemOpen[] = "<DT><A"; |
37 const char kItemClose[] = "</A>"; | 37 const char kItemClose[] = "</A>"; |
38 const char kFeedURLAttribute[] = "FEEDURL"; | 38 const char kFeedURLAttribute[] = "FEEDURL"; |
39 const char kHrefAttribute[] = "HREF"; | 39 const char kHrefAttribute[] = "HREF"; |
40 const char kIconAttribute[] = "ICON"; | 40 const char kIconAttribute[] = "ICON"; |
41 const char kShortcutURLAttribute[] = "SHORTCUTURL"; | 41 const char kShortcutURLAttribute[] = "SHORTCUTURL"; |
42 const char kAddDateAttribute[] = "ADD_DATE"; | 42 const char kAddDateAttribute[] = "ADD_DATE"; |
43 const char kPostDataAttribute[] = "POST_DATA"; | 43 const char kPostDataAttribute[] = "POST_DATA"; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 // Firefox 2 uses signons2.txt to store the pssswords. If it doesn't | 341 // Firefox 2 uses signons2.txt to store the pssswords. If it doesn't |
342 // exist, we try to find its older version. | 342 // exist, we try to find its older version. |
343 FilePath file = source_path_.AppendASCII("signons2.txt"); | 343 FilePath file = source_path_.AppendASCII("signons2.txt"); |
344 if (!file_util::PathExists(file)) { | 344 if (!file_util::PathExists(file)) { |
345 file = source_path_.AppendASCII("signons.txt"); | 345 file = source_path_.AppendASCII("signons.txt"); |
346 } | 346 } |
347 | 347 |
348 std::string content; | 348 std::string content; |
349 file_util::ReadFileToString(file, &content); | 349 file_util::ReadFileToString(file, &content); |
350 std::vector<webkit_glue::PasswordForm> forms; | 350 std::vector<webkit::forms::PasswordForm> forms; |
351 decryptor.ParseSignons(content, &forms); | 351 decryptor.ParseSignons(content, &forms); |
352 | 352 |
353 if (!cancelled()) { | 353 if (!cancelled()) { |
354 for (size_t i = 0; i < forms.size(); ++i) { | 354 for (size_t i = 0; i < forms.size(); ++i) { |
355 bridge_->SetPasswordForm(forms[i]); | 355 bridge_->SetPasswordForm(forms[i]); |
356 } | 356 } |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 void Firefox2Importer::ImportHistory() { | 360 void Firefox2Importer::ImportHistory() { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 // We need to make up a URL for the favicon. We use a version of the page's | 669 // We need to make up a URL for the favicon. We use a version of the page's |
670 // URL so that we can be sure it will not collide. | 670 // URL so that we can be sure it will not collide. |
671 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 671 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
672 | 672 |
673 // We only have one URL per favicon for Firefox 2 bookmarks. | 673 // We only have one URL per favicon for Firefox 2 bookmarks. |
674 usage.urls.insert(link_url); | 674 usage.urls.insert(link_url); |
675 | 675 |
676 favicons->push_back(usage); | 676 favicons->push_back(usage); |
677 } | 677 } |
OLD | NEW |