Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chrome/browser/importer/firefox2_importer.cc

Issue 11000016: Move forms/ out of webkit/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to review Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/i18n/icu_string_conversions.h" 12 #include "base/i18n/icu_string_conversions.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_split.h" 17 #include "base/string_split.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/history/history_types.h" 20 #include "chrome/browser/history/history_types.h"
21 #include "chrome/browser/importer/firefox_importer_utils.h" 21 #include "chrome/browser/importer/firefox_importer_utils.h"
22 #include "chrome/browser/importer/importer_bridge.h" 22 #include "chrome/browser/importer/importer_bridge.h"
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/common/time_format.h" 27 #include "chrome/common/time_format.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "content/public/common/password_form.h"
29 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
30 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
31 #include "net/base/data_url.h" 32 #include "net/base/data_url.h"
32 #include "webkit/forms/password_form.h"
33 33
34 namespace { 34 namespace {
35 const char kItemOpen[] = "<DT><A"; 35 const char kItemOpen[] = "<DT><A";
36 const char kItemClose[] = "</A>"; 36 const char kItemClose[] = "</A>";
37 const char kFeedURLAttribute[] = "FEEDURL"; 37 const char kFeedURLAttribute[] = "FEEDURL";
38 const char kHrefAttribute[] = "HREF"; 38 const char kHrefAttribute[] = "HREF";
39 const char kIconAttribute[] = "ICON"; 39 const char kIconAttribute[] = "ICON";
40 const char kShortcutURLAttribute[] = "SHORTCUTURL"; 40 const char kShortcutURLAttribute[] = "SHORTCUTURL";
41 const char kAddDateAttribute[] = "ADD_DATE"; 41 const char kAddDateAttribute[] = "ADD_DATE";
42 const char kPostDataAttribute[] = "POST_DATA"; 42 const char kPostDataAttribute[] = "POST_DATA";
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 // Firefox 2 uses signons2.txt to store the pssswords. If it doesn't 332 // Firefox 2 uses signons2.txt to store the pssswords. If it doesn't
333 // exist, we try to find its older version. 333 // exist, we try to find its older version.
334 FilePath file = source_path_.AppendASCII("signons2.txt"); 334 FilePath file = source_path_.AppendASCII("signons2.txt");
335 if (!file_util::PathExists(file)) { 335 if (!file_util::PathExists(file)) {
336 file = source_path_.AppendASCII("signons.txt"); 336 file = source_path_.AppendASCII("signons.txt");
337 } 337 }
338 338
339 std::string content; 339 std::string content;
340 file_util::ReadFileToString(file, &content); 340 file_util::ReadFileToString(file, &content);
341 std::vector<webkit::forms::PasswordForm> forms; 341 std::vector<content::PasswordForm> forms;
342 decryptor.ParseSignons(content, &forms); 342 decryptor.ParseSignons(content, &forms);
343 343
344 if (!cancelled()) { 344 if (!cancelled()) {
345 for (size_t i = 0; i < forms.size(); ++i) { 345 for (size_t i = 0; i < forms.size(); ++i) {
346 bridge_->SetPasswordForm(forms[i]); 346 bridge_->SetPasswordForm(forms[i]);
347 } 347 }
348 } 348 }
349 } 349 }
350 350
351 void Firefox2Importer::ImportHistory() { 351 void Firefox2Importer::ImportHistory() {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 657
658 // We need to make up a URL for the favicon. We use a version of the page's 658 // We need to make up a URL for the favicon. We use a version of the page's
659 // URL so that we can be sure it will not collide. 659 // URL so that we can be sure it will not collide.
660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); 660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec());
661 661
662 // We only have one URL per favicon for Firefox 2 bookmarks. 662 // We only have one URL per favicon for Firefox 2 bookmarks.
663 usage.urls.insert(link_url); 663 usage.urls.insert(link_url);
664 664
665 favicons->push_back(usage); 665 favicons->push_back(usage);
666 } 666 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/external_process_importer_client.cc ('k') | chrome/browser/importer/firefox3_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698