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

Side by Side Diff: chrome/browser/importer/safari_importer.h

Issue 6979007: Many fixes to bookmark importing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Happy tests =) Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/importer/profile_writer.cc ('k') | chrome/browser/importer/safari_importer.mm » ('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 #ifndef CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ 5 #ifndef CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_
6 #define CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ 6 #define CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Multiple URLs can share the same favicon; this is a map 65 // Multiple URLs can share the same favicon; this is a map
66 // of URLs -> IconIDs that we load as a temporary step before 66 // of URLs -> IconIDs that we load as a temporary step before
67 // actually loading the icons. 67 // actually loading the icons.
68 typedef std::map<int64, std::set<GURL> > FaviconMap; 68 typedef std::map<int64, std::set<GURL> > FaviconMap;
69 69
70 void ImportBookmarks(); 70 void ImportBookmarks();
71 void ImportPasswords(); 71 void ImportPasswords();
72 void ImportHistory(); 72 void ImportHistory();
73 73
74 // Parse Safari's stored bookmarks. 74 // Parse Safari's stored bookmarks.
75 void ParseBookmarks(std::vector<ProfileWriter::BookmarkEntry>* bookmarks); 75 void ParseBookmarks(const string16& toolbar_name,
76 std::vector<ProfileWriter::BookmarkEntry>* bookmarks);
76 77
77 // Function to recursively read Bookmarks out of Safari plist. 78 // Function to recursively read Bookmarks out of Safari plist.
78 // |bookmark_folder| The dictionary containing a folder to parse. 79 // |bookmark_folder| The dictionary containing a folder to parse.
79 // |parent_path_elements| Path elements up to this point. 80 // |parent_path_elements| Path elements up to this point.
80 // |is_in_toolbar| Is this folder in the toolbar. 81 // |is_in_toolbar| Is this folder in the toolbar.
81 // |out_bookmarks| BookMark element array to write into. 82 // |out_bookmarks| BookMark element array to write into.
82 void RecursiveReadBookmarksFolder( 83 void RecursiveReadBookmarksFolder(
83 NSDictionary* bookmark_folder, 84 NSDictionary* bookmark_folder,
84 const std::vector<string16>& parent_path_elements, 85 const std::vector<string16>& parent_path_elements,
85 bool is_in_toolbar, 86 bool is_in_toolbar,
87 const string16& toolbar_name,
86 std::vector<ProfileWriter::BookmarkEntry>* out_bookmarks); 88 std::vector<ProfileWriter::BookmarkEntry>* out_bookmarks);
87 89
88 // Converts history time stored by Safari as a double serialized as a string, 90 // Converts history time stored by Safari as a double serialized as a string,
89 // to seconds-since-UNIX-Ephoch-format used by Chrome. 91 // to seconds-since-UNIX-Ephoch-format used by Chrome.
90 double HistoryTimeToEpochTime(NSString* history_time); 92 double HistoryTimeToEpochTime(NSString* history_time);
91 93
92 // Parses Safari's history and loads it into the input array. 94 // Parses Safari's history and loads it into the input array.
93 void ParseHistoryItems(std::vector<history::URLRow>* history_items); 95 void ParseHistoryItems(std::vector<history::URLRow>* history_items);
94 96
95 // Opens the favicon database file. 97 // Opens the favicon database file.
96 bool OpenDatabase(sql::Connection* db); 98 bool OpenDatabase(sql::Connection* db);
97 99
98 // Loads the urls associated with the favicons into favicon_map; 100 // Loads the urls associated with the favicons into favicon_map;
99 void ImportFaviconURLs(sql::Connection* db, FaviconMap* favicon_map); 101 void ImportFaviconURLs(sql::Connection* db, FaviconMap* favicon_map);
100 102
101 // Loads and reencodes the individual favicons. 103 // Loads and reencodes the individual favicons.
102 void LoadFaviconData(sql::Connection* db, 104 void LoadFaviconData(sql::Connection* db,
103 const FaviconMap& favicon_map, 105 const FaviconMap& favicon_map,
104 std::vector<history::ImportedFaviconUsage>* favicons); 106 std::vector<history::ImportedFaviconUsage>* favicons);
105 107
106 FilePath library_dir_; 108 FilePath library_dir_;
107 109
108 DISALLOW_COPY_AND_ASSIGN(SafariImporter); 110 DISALLOW_COPY_AND_ASSIGN(SafariImporter);
109 }; 111 };
110 112
111 #endif // CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ 113 #endif // CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/importer/profile_writer.cc ('k') | chrome/browser/importer/safari_importer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698