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

Side by Side Diff: chrome/browser/importer/firefox3_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/firefox3_importer.h" 5 #include "chrome/browser/importer/firefox3_importer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/history/history_types.h" 16 #include "chrome/browser/history/history_types.h"
17 #include "chrome/browser/importer/firefox2_importer.h" 17 #include "chrome/browser/importer/firefox2_importer.h"
18 #include "chrome/browser/importer/firefox_importer_utils.h" 18 #include "chrome/browser/importer/firefox_importer_utils.h"
19 #include "chrome/browser/importer/importer_bridge.h" 19 #include "chrome/browser/importer/importer_bridge.h"
20 #include "chrome/browser/importer/importer_util.h" 20 #include "chrome/browser/importer/importer_util.h"
21 #include "chrome/browser/importer/nss_decryptor.h" 21 #include "chrome/browser/importer/nss_decryptor.h"
22 #include "chrome/browser/search_engines/template_url.h" 22 #include "chrome/browser/search_engines/template_url.h"
23 #include "chrome/common/time_format.h" 23 #include "chrome/common/time_format.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/common/password_form.h"
25 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
26 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
27 #include "sql/connection.h" 28 #include "sql/connection.h"
28 #include "sql/statement.h" 29 #include "sql/statement.h"
29 #include "webkit/forms/password_form.h"
30 30
31 using content::BrowserThread; 31 using content::BrowserThread;
32 32
33 namespace { 33 namespace {
34 34
35 // Original definition is in http://mxr.mozilla.org/firefox/source/toolkit/ 35 // Original definition is in http://mxr.mozilla.org/firefox/source/toolkit/
36 // components/places/public/nsINavBookmarksService.idl 36 // components/places/public/nsINavBookmarksService.idl
37 enum BookmarkItemType { 37 enum BookmarkItemType {
38 TYPE_BOOKMARK = 1, 38 TYPE_BOOKMARK = 1,
39 TYPE_FOLDER = 2, 39 TYPE_FOLDER = 2,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 void Firefox3Importer::ImportPasswords() { 302 void Firefox3Importer::ImportPasswords() {
303 // Initializes NSS3. 303 // Initializes NSS3.
304 NSSDecryptor decryptor; 304 NSSDecryptor decryptor;
305 if (!decryptor.Init(source_path_, source_path_) && 305 if (!decryptor.Init(source_path_, source_path_) &&
306 !decryptor.Init(app_path_, source_path_)) { 306 !decryptor.Init(app_path_, source_path_)) {
307 return; 307 return;
308 } 308 }
309 309
310 std::vector<webkit::forms::PasswordForm> forms; 310 std::vector<content::PasswordForm> forms;
311 FilePath source_path = source_path_; 311 FilePath source_path = source_path_;
312 FilePath file = source_path.AppendASCII("signons.sqlite"); 312 FilePath file = source_path.AppendASCII("signons.sqlite");
313 if (file_util::PathExists(file)) { 313 if (file_util::PathExists(file)) {
314 // Since Firefox 3.1, passwords are in signons.sqlite db. 314 // Since Firefox 3.1, passwords are in signons.sqlite db.
315 decryptor.ReadAndParseSignons(file, &forms); 315 decryptor.ReadAndParseSignons(file, &forms);
316 } else { 316 } else {
317 // Firefox 3.0 uses signons3.txt to store the passwords. 317 // Firefox 3.0 uses signons3.txt to store the passwords.
318 file = source_path.AppendASCII("signons3.txt"); 318 file = source_path.AppendASCII("signons3.txt");
319 if (!file_util::PathExists(file)) 319 if (!file_util::PathExists(file))
320 file = source_path.AppendASCII("signons2.txt"); 320 file = source_path.AppendASCII("signons2.txt");
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 562
563 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data)) 563 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data))
564 continue; // Unable to decode. 564 continue; // Unable to decode.
565 565
566 usage.urls = i->second; 566 usage.urls = i->second;
567 favicons->push_back(usage); 567 favicons->push_back(usage);
568 } 568 }
569 s.Reset(true); 569 s.Reset(true);
570 } 570 }
571 } 571 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/firefox_importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698