| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ | 5 #ifndef CHROME_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ |
| 6 #define CHROME_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ | 6 #define CHROME_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/gtest_prod_util.h" |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "chrome/utility/importer/importer.h" | 22 #include "chrome/utility/importer/importer.h" |
| 22 #include "components/favicon_base/favicon_usage_data.h" | 23 #include "components/favicon_base/favicon_usage_data.h" |
| 23 | 24 |
| 24 class GURL; | 25 class GURL; |
| 25 | 26 |
| 26 namespace sql { | 27 namespace sql { |
| 27 class Connection; | 28 class Connection; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Importer for Mozilla Firefox 3 and later. | 31 // Importer for Mozilla Firefox 3 and later. |
| 31 // Firefox stores its persistent information in a system called places. | 32 // Firefox stores its persistent information in a system called places. |
| 32 // http://wiki.mozilla.org/Places | 33 // http://wiki.mozilla.org/Places |
| 33 class FirefoxImporter : public Importer { | 34 class FirefoxImporter : public Importer { |
| 34 public: | 35 public: |
| 35 FirefoxImporter(); | 36 FirefoxImporter(); |
| 36 | 37 |
| 37 // Importer: | 38 // Importer: |
| 38 void StartImport(const importer::SourceProfile& source_profile, | 39 void StartImport(const importer::SourceProfile& source_profile, |
| 39 uint16_t items, | 40 uint16_t items, |
| 40 ImporterBridge* bridge) override; | 41 ImporterBridge* bridge) override; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 using FaviconMap = std::map<int64_t, std::set<GURL>>; | 44 using FaviconMap = std::map<int64_t, std::set<GURL>>; |
| 44 | 45 |
| 45 ~FirefoxImporter() override; | 46 ~FirefoxImporter() override; |
| 46 | 47 |
| 48 FRIEND_TEST_ALL_PREFIXES(FirefoxImporterTest, ImportBookmarksV25); |
| 47 void ImportBookmarks(); | 49 void ImportBookmarks(); |
| 48 void ImportPasswords(); | 50 void ImportPasswords(); |
| 49 void ImportHistory(); | 51 void ImportHistory(); |
| 50 void ImportSearchEngines(); | 52 void ImportSearchEngines(); |
| 51 // Import the user's home page, unless it is set to default home page as | 53 // Import the user's home page, unless it is set to default home page as |
| 52 // defined in browserconfig.properties. | 54 // defined in browserconfig.properties. |
| 53 void ImportHomepage(); | 55 void ImportHomepage(); |
| 54 void ImportAutofillFormData(); | 56 void ImportAutofillFormData(); |
| 55 void GetSearchEnginesXMLData(std::vector<std::string>* search_engine_data); | 57 void GetSearchEnginesXMLData(std::vector<std::string>* search_engine_data); |
| 56 void GetSearchEnginesXMLDataFromJSON( | 58 void GetSearchEnginesXMLDataFromJSON( |
| 57 std::vector<std::string>* search_engine_data); | 59 std::vector<std::string>* search_engine_data); |
| 58 | 60 |
| 59 // The struct stores the information about a bookmark item. | 61 // The struct stores the information about a bookmark item. |
| 60 struct BookmarkItem; | 62 struct BookmarkItem; |
| 61 using BookmarkList = std::vector<std::unique_ptr<BookmarkItem>>; | 63 using BookmarkList = std::vector<std::unique_ptr<BookmarkItem>>; |
| 62 | 64 |
| 63 // Gets the specific IDs of bookmark root node from |db|. | 65 // Gets the specific ID of bookmark node with given GUID from |db|. |
| 64 void LoadRootNodeID(sql::Connection* db, int* toolbar_folder_id, | 66 // Returns -1 if not found. |
| 65 int* menu_folder_id, int* unsorted_folder_id); | 67 int LoadNodeIDByGUID(sql::Connection* db, const std::string& GUID); |
| 66 | 68 |
| 67 // Loads all livemark IDs from database |db|. | 69 // Loads all livemark IDs from database |db|. |
| 68 void LoadLivemarkIDs(sql::Connection* db, std::set<int>* livemark); | 70 void LoadLivemarkIDs(sql::Connection* db, std::set<int>* livemark); |
| 69 | 71 |
| 70 // Gets the bookmark folder with given ID, and adds the entry in |list| | 72 // Gets the bookmark folder with given ID, and adds the entry in |list| |
| 71 // if successful. | 73 // if successful. |
| 72 void GetTopBookmarkFolder(sql::Connection* db, | 74 void GetTopBookmarkFolder(sql::Connection* db, |
| 73 int folder_id, | 75 int folder_id, |
| 74 BookmarkList* list); | 76 BookmarkList* list); |
| 75 | 77 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 | 90 |
| 89 #if defined(OS_POSIX) | 91 #if defined(OS_POSIX) |
| 90 // Stored because we can only access it from the UI thread. | 92 // Stored because we can only access it from the UI thread. |
| 91 std::string locale_; | 93 std::string locale_; |
| 92 #endif | 94 #endif |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(FirefoxImporter); | 96 DISALLOW_COPY_AND_ASSIGN(FirefoxImporter); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 #endif // CHROME_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ | 99 #endif // CHROME_UTILITY_IMPORTER_FIREFOX_IMPORTER_H_ |
| OLD | NEW |