OLD | NEW |
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_IE_IMPORTER_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ |
6 #define CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ | 6 #define CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | |
10 #include <vector> | 9 #include <vector> |
11 | 10 |
12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
15 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/string16.h" |
16 #include "chrome/browser/importer/importer.h" | 16 #include "chrome/browser/importer/importer.h" |
17 #include "chrome/browser/importer/profile_writer.h" | 17 #include "chrome/browser/importer/profile_writer.h" |
18 | 18 |
19 class IEImporter : public Importer { | 19 class IEImporter : public Importer { |
20 public: | 20 public: |
21 IEImporter(); | 21 IEImporter(); |
22 | 22 |
23 // Importer: | 23 // Importer: |
24 virtual void StartImport(const importer::SourceProfile& source_profile, | 24 virtual void StartImport(const importer::SourceProfile& source_profile, |
25 uint16 items, | 25 uint16 items, |
26 ImporterBridge* bridge) OVERRIDE; | 26 ImporterBridge* bridge) OVERRIDE; |
27 | 27 |
28 private: | 28 private: |
29 typedef std::vector<ProfileWriter::BookmarkEntry> BookmarkVector; | 29 typedef std::vector<ProfileWriter::BookmarkEntry> BookmarkVector; |
30 | 30 |
31 // A struct that hosts the information of IE Favorite folder. | 31 // A struct that hosts the information of IE Favorite folder. |
32 struct FavoritesInfo { | 32 struct FavoritesInfo { |
33 FilePath path; | 33 FilePath path; |
34 std::wstring links_folder; | 34 string16 links_folder; |
35 }; | 35 }; |
36 | 36 |
37 // IE PStore subkey GUID: AutoComplete password & form data. | 37 // IE PStore subkey GUID: AutoComplete password & form data. |
38 static const GUID kPStoreAutocompleteGUID; | 38 static const GUID kPStoreAutocompleteGUID; |
39 | 39 |
40 // A fake GUID for unit test. | 40 // A fake GUID for unit test. |
41 static const GUID kUnittestGUID; | 41 static const GUID kUnittestGUID; |
42 | 42 |
43 FRIEND_TEST_ALL_PREFIXES(ImporterTest, IEImporter); | 43 FRIEND_TEST_ALL_PREFIXES(ImporterTest, IEImporter); |
44 | 44 |
(...skipping 13 matching lines...) Expand all Loading... |
58 void ImportSearchEngines(); | 58 void ImportSearchEngines(); |
59 | 59 |
60 // Import the homepage setting of IE. Note: IE supports multiple home pages, | 60 // Import the homepage setting of IE. Note: IE supports multiple home pages, |
61 // whereas Chrome doesn't, so we import only the one defined under the | 61 // whereas Chrome doesn't, so we import only the one defined under the |
62 // 'Start Page' registry key. We don't import if the homepage is set to the | 62 // 'Start Page' registry key. We don't import if the homepage is set to the |
63 // machine default. | 63 // machine default. |
64 void ImportHomepage(); | 64 void ImportHomepage(); |
65 | 65 |
66 // Resolves what's the .url file actually targets. | 66 // Resolves what's the .url file actually targets. |
67 // Returns empty string if failed. | 67 // Returns empty string if failed. |
68 std::wstring ResolveInternetShortcut(const std::wstring& file); | 68 string16 ResolveInternetShortcut(const string16& file); |
69 | 69 |
70 // Gets the information of Favorites folder. Returns true if successful. | 70 // Gets the information of Favorites folder. Returns true if successful. |
71 bool GetFavoritesInfo(FavoritesInfo* info); | 71 bool GetFavoritesInfo(FavoritesInfo* info); |
72 | 72 |
73 // This function will read the files in the Favorite folder, and store | 73 // This function will read the files in the Favorite folder, and store |
74 // the bookmark items in |bookmarks|. | 74 // the bookmark items in |bookmarks|. |
75 void ParseFavoritesFolder(const FavoritesInfo& info, | 75 void ParseFavoritesFolder(const FavoritesInfo& info, |
76 BookmarkVector* bookmarks); | 76 BookmarkVector* bookmarks); |
77 | 77 |
78 // Determines which version of IE is in use. | 78 // Determines which version of IE is in use. |
79 int CurrentIEVersion() const; | 79 int CurrentIEVersion() const; |
80 | 80 |
81 // IE does not have source path. It's used in unit tests only for providing a | 81 // IE does not have source path. It's used in unit tests only for providing a |
82 // fake source. | 82 // fake source. |
83 FilePath source_path_; | 83 FilePath source_path_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(IEImporter); | 85 DISALLOW_COPY_AND_ASSIGN(IEImporter); |
86 }; | 86 }; |
87 | 87 |
88 #endif // CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ | 88 #endif // CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ |
OLD | NEW |