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

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

Issue 8680040: Group forms-related files in webkit/glue in a forms/ subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + another build fix Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/ie_importer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "sql/connection.h" 27 #include "sql/connection.h"
28 #include "sql/statement.h" 28 #include "sql/statement.h"
29 #include "webkit/glue/password_form.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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 void Firefox3Importer::ImportPasswords() { 306 void Firefox3Importer::ImportPasswords() {
307 // Initializes NSS3. 307 // Initializes NSS3.
308 NSSDecryptor decryptor; 308 NSSDecryptor decryptor;
309 if (!decryptor.Init(source_path_, source_path_) && 309 if (!decryptor.Init(source_path_, source_path_) &&
310 !decryptor.Init(app_path_, source_path_)) { 310 !decryptor.Init(app_path_, source_path_)) {
311 return; 311 return;
312 } 312 }
313 313
314 std::vector<webkit_glue::PasswordForm> forms; 314 std::vector<webkit::forms::PasswordForm> forms;
315 FilePath source_path = source_path_; 315 FilePath source_path = source_path_;
316 FilePath file = source_path.AppendASCII("signons.sqlite"); 316 FilePath file = source_path.AppendASCII("signons.sqlite");
317 if (file_util::PathExists(file)) { 317 if (file_util::PathExists(file)) {
318 // Since Firefox 3.1, passwords are in signons.sqlite db. 318 // Since Firefox 3.1, passwords are in signons.sqlite db.
319 decryptor.ReadAndParseSignons(file, &forms); 319 decryptor.ReadAndParseSignons(file, &forms);
320 } else { 320 } else {
321 // Firefox 3.0 uses signons3.txt to store the passwords. 321 // Firefox 3.0 uses signons3.txt to store the passwords.
322 file = source_path.AppendASCII("signons3.txt"); 322 file = source_path.AppendASCII("signons3.txt");
323 if (!file_util::PathExists(file)) 323 if (!file_util::PathExists(file))
324 file = source_path.AppendASCII("signons2.txt"); 324 file = source_path.AppendASCII("signons2.txt");
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data)) 575 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data))
576 continue; // Unable to decode. 576 continue; // Unable to decode.
577 577
578 usage.urls = i->second; 578 usage.urls = i->second;
579 favicons->push_back(usage); 579 favicons->push_back(usage);
580 } 580 }
581 s.Reset(); 581 s.Reset();
582 } 582 }
583 } 583 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/ie_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698