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

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

Issue 18501013: Move most importer code to chrome/utility/importer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac4 Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UTILITY_IMPORTER_SAFARI_IMPORTER_H_
6 #define CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ 6 #define CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "chrome/browser/history/history_types.h"
17 #include "chrome/browser/importer/importer.h"
18 #include "chrome/common/importer/importer_url_row.h" 16 #include "chrome/common/importer/importer_url_row.h"
17 #include "chrome/utility/importer/importer.h"
19 18
20 #if __OBJC__ 19 #if __OBJC__
21 @class NSDictionary; 20 @class NSDictionary;
22 @class NSString; 21 @class NSString;
23 #else 22 #else
24 class NSDictionary; 23 class NSDictionary;
25 class NSString; 24 class NSString;
26 #endif 25 #endif
27 26
28 class GURL; 27 class GURL;
29 struct ImportedBookmarkEntry; 28 struct ImportedBookmarkEntry;
30 struct ImportedFaviconUsage; 29 struct ImportedFaviconUsage;
31 30
32 namespace history {
33 class URLRow;
34 }
35
36 namespace sql { 31 namespace sql {
37 class Connection; 32 class Connection;
38 } 33 }
39 34
40 // Importer for Safari on OS X. 35 // Importer for Safari on OS X.
41 class SafariImporter : public Importer { 36 class SafariImporter : public Importer {
42 public: 37 public:
43 // |library_dir| is the full path to the ~/Library directory, 38 // |library_dir| is the full path to the ~/Library directory,
44 // We pass it in as a parameter for testing purposes. 39 // We pass it in as a parameter for testing purposes.
45 explicit SafariImporter(const base::FilePath& library_dir); 40 explicit SafariImporter(const base::FilePath& library_dir);
46 41
47 // Importer: 42 // Importer:
48 virtual void StartImport(const importer::SourceProfile& source_profile, 43 virtual void StartImport(const importer::SourceProfile& source_profile,
49 uint16 items, 44 uint16 items,
50 ImporterBridge* bridge) OVERRIDE; 45 ImporterBridge* bridge) OVERRIDE;
51 46
52 // Does this user account have a Safari Profile and if so, what items
53 // are supported?
54 // in: library_dir - ~/Library or a standin for testing purposes.
55 // out: services_supported - the service supported for import.
56 // Returns true if we can import the Safari profile.
57 static bool CanImport(const base::FilePath& library_dir,
58 uint16* services_supported);
59
60 private: 47 private:
61 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, BookmarkImport); 48 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, BookmarkImport);
62 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, FaviconImport); 49 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, FaviconImport);
63 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, HistoryImport); 50 FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, HistoryImport);
64 51
65 virtual ~SafariImporter(); 52 virtual ~SafariImporter();
66 53
67 // Multiple URLs can share the same favicon; this is a map 54 // Multiple URLs can share the same favicon; this is a map
68 // of URLs -> IconIDs that we load as a temporary step before 55 // of URLs -> IconIDs that we load as a temporary step before
69 // actually loading the icons. 56 // actually loading the icons.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Loads and reencodes the individual favicons. 92 // Loads and reencodes the individual favicons.
106 void LoadFaviconData(sql::Connection* db, 93 void LoadFaviconData(sql::Connection* db,
107 const FaviconMap& favicon_map, 94 const FaviconMap& favicon_map,
108 std::vector<ImportedFaviconUsage>* favicons); 95 std::vector<ImportedFaviconUsage>* favicons);
109 96
110 base::FilePath library_dir_; 97 base::FilePath library_dir_;
111 98
112 DISALLOW_COPY_AND_ASSIGN(SafariImporter); 99 DISALLOW_COPY_AND_ASSIGN(SafariImporter);
113 }; 100 };
114 101
115 #endif // CHROME_BROWSER_IMPORTER_SAFARI_IMPORTER_H_ 102 #endif // CHROME_UTILITY_IMPORTER_SAFARI_IMPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698