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 3// found in the LICENSE file. 4 5#ifndef CHROME_COMMON_IMPORTER_IMPORTER_DATA_TYPES_H_ 6#define CHROME_COMMON_IMPORTER_IMPORTER_DATA_TYPES_H_ 7 8#include <string> 9#include <vector> 10 11#include "base/basictypes.h" 12#include "base/files/file_path.h" 13#include "base/memory/ref_counted.h" 14#include "base/strings/string16.h" 15#include "base/time/time.h" 16#include "chrome/common/importer/importer_type.h" 17#include "url/gurl.h" 18 19// Types needed for importing data from other browsers and the Google Toolbar. 20namespace importer { 21 22// An enumeration of the type of data that can be imported. 23enum ImportItem { 24 NONE = 0, 25 HISTORY = 1 << 0, 26 FAVORITES = 1 << 1, 27 COOKIES = 1 << 2, // Not supported yet. 28 PASSWORDS = 1 << 3, 29 SEARCH_ENGINES = 1 << 4, 30 HOME_PAGE = 1 << 5, 31 ALL = (1 << 6) - 1 // All the bits should be 1, hence the -1. 32}; 33 34// Information about a profile needed by an importer to do import work. 35struct SourceProfile { 36 SourceProfile(); 37 ~SourceProfile(); 38 39 base::string16 importer_name; 40 ImporterType importer_type; 41 base::FilePath source_path; 42 base::FilePath app_path; 43 uint16 services_supported; // Bitmask of ImportItem. 44 // The application locale. Stored because we can only access it from the UI 45 // thread on the browser process. This is only used by the Firefox importer. 46 std::string locale; 47}; 48 49// Contains information needed for importing bookmarks/search engine urls, etc. 50struct URLKeywordInfo { 51 GURL url; 52 base::string16 keyword; 53 base::string16 display_name; 54}; 55 56#if defined(OS_WIN) 57// Contains the information read from the IE7/IE8 Storage2 key in the registry. 58struct ImporterIE7PasswordInfo { 59 // Hash of the url. 60 std::wstring url_hash; 61 62 // Encrypted data containing the username, password and some more 63 // undocumented fields. 64 std::vector<unsigned char> encrypted_data; 65 66 // When the login was imported. 67 base::Time date_created; 68}; 69#endif 70 71// Mapped to history::VisitSource after import in the browser. 72enum VisitSource { 73 VISIT_SOURCE_BROWSED = 0, 74 VISIT_SOURCE_FIREFOX_IMPORTED = 1, 75 VISIT_SOURCE_IE_IMPORTED = 2, 76 VISIT_SOURCE_SAFARI_IMPORTED = 3, 77}; 78 79} // namespace importer 80 81#endif // CHROME_COMMON_IMPORTER_IMPORTER_DATA_TYPES_H_ 82