Home | History | Annotate | Download | only in importer
      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.
     20 namespace importer {
     21 
     22 // An enumeration of the type of data that can be imported.
     23 enum 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   AUTOFILL_FORM_DATA = 1 << 6,
     32   ALL                = (1 << 7) - 1  // All the bits should be 1, hence the -1.
     33 };
     34 
     35 // Information about a profile needed by an importer to do import work.
     36 struct SourceProfile {
     37   SourceProfile();
     38   ~SourceProfile();
     39 
     40   base::string16 importer_name;
     41   ImporterType importer_type;
     42   base::FilePath source_path;
     43   base::FilePath app_path;
     44   uint16 services_supported;  // Bitmask of ImportItem.
     45   // The application locale. Stored because we can only access it from the UI
     46   // thread on the browser process. This is only used by the Firefox importer.
     47   std::string locale;
     48 };
     49 
     50 // Contains information needed for importing bookmarks/search engine urls, etc.
     51 struct URLKeywordInfo {
     52   GURL url;
     53   base::string16 keyword;
     54   base::string16 display_name;
     55 };
     56 
     57 #if defined(OS_WIN)
     58 // Contains the information read from the IE7/IE8 Storage2 key in the registry.
     59 struct ImporterIE7PasswordInfo {
     60   // Hash of the url.
     61   std::wstring url_hash;
     62 
     63   // Encrypted data containing the username, password and some more
     64   // undocumented fields.
     65   std::vector<unsigned char> encrypted_data;
     66 
     67   // When the login was imported.
     68   base::Time date_created;
     69 };
     70 #endif
     71 
     72 // Mapped to history::VisitSource after import in the browser.
     73 enum VisitSource {
     74   VISIT_SOURCE_BROWSED = 0,
     75   VISIT_SOURCE_FIREFOX_IMPORTED = 1,
     76   VISIT_SOURCE_IE_IMPORTED = 2,
     77   VISIT_SOURCE_SAFARI_IMPORTED = 3,
     78 };
     79 
     80 }  // namespace importer
     81 
     82 #endif  // CHROME_COMMON_IMPORTER_IMPORTER_DATA_TYPES_H_
     83