summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-22 18:05:00 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-22 18:05:00 +0000
commit750d1df01bae3a105313008e649d6a8e756bc316 (patch)
tree91a7fc834ff20b05ad6539ae77dfbf2ed750058a
parent5497a645dc2d609481a04328a96f3f9a4a13f46c (diff)
downloadchromium_src-750d1df01bae3a105313008e649d6a8e756bc316.zip
chromium_src-750d1df01bae3a105313008e649d6a8e756bc316.tar.gz
chromium_src-750d1df01bae3a105313008e649d6a8e756bc316.tar.bz2
Convert a bunch more of importer into FilePath.
I thought this would be a small job but I pulled the thread and it kept coming. :( BUG=24672 Review URL: http://codereview.chromium.org/650034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39610 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer_unittest.cc2
-rw-r--r--chrome/browser/importer/firefox2_importer.cc59
-rw-r--r--chrome/browser/importer/firefox2_importer.h15
-rw-r--r--chrome/browser/importer/firefox3_importer.cc71
-rw-r--r--chrome/browser/importer/firefox3_importer.h7
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc32
-rw-r--r--chrome/browser/importer/firefox_importer_utils.h8
-rw-r--r--chrome/browser/importer/mork_reader.cc6
-rw-r--r--chrome/browser/importer/mork_reader.h6
9 files changed, 99 insertions, 107 deletions
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
index 8f1d2fc..765f029 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -224,7 +224,7 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
// Read the bookmarks back in.
std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks;
std::vector<history::ImportedFavIconUsage> favicons;
- Firefox2Importer::ImportBookmarksFile(path_.ToWStringHack(), std::set<GURL>(),
+ Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(),
false, L"x", NULL, &parsed_bookmarks,
NULL, &favicons);
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 19c1a82..276144e 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -41,8 +41,8 @@ void Firefox2Importer::StartImport(ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge) {
bridge_ = bridge;
- source_path_ = profile_info.source_path;
- app_path_ = profile_info.app_path;
+ source_path_ = FilePath::FromWStringHack(profile_info.source_path);
+ app_path_ = FilePath::FromWStringHack(profile_info.app_path);
parsing_bookmarks_html_file_ = (profile_info.browser_type == BOOKMARKS_HTML);
@@ -79,18 +79,17 @@ void Firefox2Importer::StartImport(ProfileInfo profile_info,
}
// static
-void Firefox2Importer::LoadDefaultBookmarks(const std::wstring& app_path,
+void Firefox2Importer::LoadDefaultBookmarks(const FilePath& app_path,
std::set<GURL> *urls) {
- FilePath file = FilePath::FromWStringHack(app_path);
- file = file.AppendASCII("defaults");
- file = file.AppendASCII("profile");
- file = file.AppendASCII("bookmarks.html");
+ FilePath file = app_path.AppendASCII("defaults")
+ .AppendASCII("profile")
+ .AppendASCII("bookmarks.html");
urls->clear();
// Read the whole file.
std::string content;
- file_util::ReadFileToString(file.ToWStringHack(), &content);
+ file_util::ReadFileToString(file, &content);
std::vector<std::string> lines;
SplitString(content, '\n', &lines);
@@ -136,7 +135,7 @@ TemplateURL* Firefox2Importer::CreateTemplateURL(const std::wstring& title,
// static
void Firefox2Importer::ImportBookmarksFile(
- const std::wstring& file_path,
+ const FilePath& file_path,
const std::set<GURL>& default_urls,
bool import_to_bookmark_bar,
const std::wstring& first_folder_name,
@@ -250,9 +249,9 @@ void Firefox2Importer::ImportBookmarks() {
std::vector<ProfileWriter::BookmarkEntry> bookmarks, toolbar_bookmarks;
std::vector<TemplateURL*> template_urls;
std::vector<history::ImportedFavIconUsage> favicons;
- std::wstring file = source_path_;
+ FilePath file = source_path_;
if (!parsing_bookmarks_html_file_)
- file_util::AppendToPath(&file, L"bookmarks.html");
+ file = file.AppendASCII("bookmarks.html");
std::wstring first_folder_name;
if (parsing_bookmarks_html_file_)
first_folder_name = l10n_util::GetString(IDS_BOOKMARK_GROUP);
@@ -284,17 +283,18 @@ void Firefox2Importer::ImportBookmarks() {
void Firefox2Importer::ImportPasswords() {
// Initializes NSS3.
NSSDecryptor decryptor;
- if (!decryptor.Init(source_path_, source_path_) &&
- !decryptor.Init(app_path_, source_path_))
+ if (!decryptor.Init(source_path_.ToWStringHack(),
+ source_path_.ToWStringHack()) &&
+ !decryptor.Init(app_path_.ToWStringHack(),
+ source_path_.ToWStringHack())) {
return;
+ }
// Firefox 2 uses signons2.txt to store the pssswords. If it doesn't
// exist, we try to find its older version.
- std::wstring file = source_path_;
- file_util::AppendToPath(&file, L"signons2.txt");
- if (!file_util::PathExists(FilePath::FromWStringHack(file))) {
- file = source_path_;
- file_util::AppendToPath(&file, L"signons.txt");
+ FilePath file = source_path_.AppendASCII("signons2.txt");
+ if (!file_util::PathExists(file)) {
+ file = source_path_.AppendASCII("signons.txt");
}
std::string content;
@@ -310,13 +310,12 @@ void Firefox2Importer::ImportPasswords() {
}
void Firefox2Importer::ImportHistory() {
- std::wstring file = source_path_;
- file_util::AppendToPath(&file, L"history.dat");
+ FilePath file = source_path_.AppendASCII("history.dat");
ImportHistoryFromFirefox2(file, bridge_);
}
void Firefox2Importer::ImportSearchEngines() {
- std::vector<std::wstring> files;
+ std::vector<FilePath> files;
GetSearchEnginesXMLFiles(&files);
std::vector<TemplateURL*> search_engines;
@@ -335,17 +334,15 @@ void Firefox2Importer::ImportHomepage() {
}
void Firefox2Importer::GetSearchEnginesXMLFiles(
- std::vector<std::wstring>* files) {
+ std::vector<FilePath>* files) {
// Search engines are contained in XML files in a searchplugins directory that
// can be found in 2 locations:
// - Firefox install dir (default search engines)
// - the profile dir (user added search engines)
- std::wstring dir(app_path_);
- file_util::AppendToPath(&dir, L"searchplugins");
+ FilePath dir = app_path_.AppendASCII("searchplugins");
FindXMLFilesInDir(dir, files);
- std::wstring profile_dir = source_path_;
- file_util::AppendToPath(&profile_dir, L"searchplugins");
+ FilePath profile_dir = source_path_.AppendASCII("searchplugins");
FindXMLFilesInDir(profile_dir, files);
}
@@ -535,15 +532,15 @@ void Firefox2Importer::HTMLUnescape(std::wstring *text) {
// static
void Firefox2Importer::FindXMLFilesInDir(
- const std::wstring& dir,
- std::vector<std::wstring>* xml_files) {
- file_util::FileEnumerator file_enum(FilePath::FromWStringHack(dir), false,
+ const FilePath& dir,
+ std::vector<FilePath>* xml_files) {
+ file_util::FileEnumerator file_enum(dir, false,
file_util::FileEnumerator::FILES,
FILE_PATH_LITERAL("*.xml"));
- std::wstring file(file_enum.Next().ToWStringHack());
+ FilePath file(file_enum.Next());
while (!file.empty()) {
xml_files->push_back(file);
- file = file_enum.Next().ToWStringHack();
+ file = file_enum.Next();
}
}
diff --git a/chrome/browser/importer/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h
index 79b6780..95e3cc8 100644
--- a/chrome/browser/importer/firefox2_importer.h
+++ b/chrome/browser/importer/firefox2_importer.h
@@ -7,6 +7,7 @@
#include <set>
+#include "base/file_path.h"
#include "chrome/browser/importer/importer.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
@@ -24,7 +25,7 @@ class Firefox2Importer : public Importer {
// Loads the default bookmarks in the Firefox installed at |firefox_app_path|,
// and stores their locations in |urls|.
- static void LoadDefaultBookmarks(const std::wstring& firefox_app_path,
+ static void LoadDefaultBookmarks(const FilePath& firefox_app_path,
std::set<GURL> *urls);
// Creates a TemplateURL with the |keyword| and |url|. |title| may be empty.
@@ -37,7 +38,7 @@ class Firefox2Importer : public Importer {
// |favicons| may be null, in which case TemplateURLs and favicons are
// not parsed. Any bookmarks in |default_urls| are ignored.
static void ImportBookmarksFile(
- const std::wstring& file_path,
+ const FilePath& file_path,
const std::set<GURL>& default_urls,
bool import_to_bookmark_bar,
const std::wstring& first_folder_name,
@@ -62,7 +63,7 @@ class Firefox2Importer : public Importer {
// Fills |files| with the paths to the files containing the search engine
// descriptions.
- void GetSearchEnginesXMLFiles(std::vector<std::wstring>* files);
+ void GetSearchEnginesXMLFiles(std::vector<FilePath>* files);
// Helper methods for parsing bookmark file.
// Firefox 2 saves its bookmarks in a html file. We are interested in the
@@ -106,8 +107,8 @@ class Firefox2Importer : public Importer {
static void HTMLUnescape(std::wstring* text);
// Fills |xml_files| with the file with an xml extension found under |dir|.
- static void FindXMLFilesInDir(const std::wstring& dir,
- std::vector<std::wstring>* xml_files);
+ static void FindXMLFilesInDir(const FilePath& dir,
+ std::vector<FilePath>* xml_files);
// Given the URL of a page and a favicon data URL, adds an appropriate record
// to the given favicon usage vector. Will do nothing if the favicon is not
@@ -117,8 +118,8 @@ class Firefox2Importer : public Importer {
const GURL& favicon_data,
std::vector<history::ImportedFavIconUsage>* favicons);
- std::wstring source_path_;
- std::wstring app_path_;
+ FilePath source_path_;
+ FilePath app_path_;
// If true, we only parse the bookmarks.html file specified as source_path_.
bool parsing_bookmarks_html_file_;
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index 028c6fa..eacb945 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -30,8 +30,8 @@ void Firefox3Importer::StartImport(ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge) {
bridge_ = bridge;
- source_path_ = profile_info.source_path;
- app_path_ = profile_info.app_path;
+ source_path_ = FilePath::FromWStringHack(profile_info.source_path);
+ app_path_ = FilePath::FromWStringHack(profile_info.app_path);
// The order here is important!
@@ -67,14 +67,15 @@ void Firefox3Importer::StartImport(ProfileInfo profile_info,
}
void Firefox3Importer::ImportHistory() {
- std::wstring file = source_path_;
- file_util::AppendToPath(&file, L"places.sqlite");
- if (!file_util::PathExists(FilePath::FromWStringHack(file)))
+ FilePath file = source_path_.AppendASCII("places.sqlite");
+ if (!file_util::PathExists(file))
return;
sqlite3* sqlite;
- if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
+ if (sqlite3_open(WideToUTF8(file.ToWStringHack()).c_str(),
+ &sqlite) != SQLITE_OK) {
return;
+ }
sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
SQLStatement s;
@@ -115,14 +116,15 @@ void Firefox3Importer::ImportHistory() {
}
void Firefox3Importer::ImportBookmarks() {
- std::wstring file = source_path_;
- file_util::AppendToPath(&file, L"places.sqlite");
- if (!file_util::PathExists(FilePath::FromWStringHack(file)))
+ FilePath file = source_path_.AppendASCII("places.sqlite");
+ if (!file_util::PathExists(file))
return;
sqlite3* sqlite;
- if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
+ if (sqlite3_open(WideToUTF8(file.ToWStringHack()).c_str(),
+ &sqlite) != SQLITE_OK) {
return;
+ }
sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
// Get the bookmark folders that we are interested in.
@@ -265,12 +267,15 @@ void Firefox3Importer::ImportBookmarks() {
void Firefox3Importer::ImportPasswords() {
// Initializes NSS3.
NSSDecryptor decryptor;
- if (!decryptor.Init(source_path_, source_path_) &&
- !decryptor.Init(app_path_, source_path_))
+ if (!decryptor.Init(source_path_.ToWStringHack(),
+ source_path_.ToWStringHack()) &&
+ !decryptor.Init(app_path_.ToWStringHack(),
+ source_path_.ToWStringHack())) {
return;
+ }
std::vector<PasswordForm> forms;
- FilePath source_path = FilePath::FromWStringHack(source_path_);
+ FilePath source_path = source_path_;
FilePath file = source_path.AppendASCII("signons.sqlite");
if (file_util::PathExists(file)) {
// Since Firefox 3.1, passwords are in signons.sqlite db.
@@ -294,7 +299,7 @@ void Firefox3Importer::ImportPasswords() {
}
void Firefox3Importer::ImportSearchEngines() {
- std::vector<std::wstring> files;
+ std::vector<FilePath> files;
GetSearchEnginesXMLFiles(&files);
std::vector<TemplateURL*> search_engines;
@@ -312,15 +317,16 @@ void Firefox3Importer::ImportHomepage() {
}
void Firefox3Importer::GetSearchEnginesXMLFiles(
- std::vector<std::wstring>* files) {
- std::wstring file = source_path_;
- file_util::AppendToPath(&file, L"search.sqlite");
- if (!file_util::PathExists(FilePath::FromWStringHack(file)))
+ std::vector<FilePath>* files) {
+ FilePath file = source_path_.AppendASCII("search.sqlite");
+ if (!file_util::PathExists(file))
return;
sqlite3* sqlite;
- if (sqlite3_open(WideToUTF8(file).c_str(), &sqlite) != SQLITE_OK)
+ if (sqlite3_open(WideToUTF8(file.ToWStringHack()).c_str(),
+ &sqlite) != SQLITE_OK) {
return;
+ }
sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
SQLStatement s;
@@ -333,10 +339,8 @@ void Firefox3Importer::GetSearchEnginesXMLFiles(
if (s.prepare(db.get(), stmt) != SQLITE_OK)
return;
- std::wstring app_path = app_path_;
- file_util::AppendToPath(&app_path, L"searchplugins");
- std::wstring profile_path = source_path_;
- file_util::AppendToPath(&profile_path, L"searchplugins");
+ FilePath app_path = app_path_.AppendASCII("searchplugins");
+ FilePath profile_path = source_path_.AppendASCII("searchplugins");
// Firefox doesn't store a search engine in its sqlite database unless
// the user has changed the default definition of engine. So we get search
@@ -345,7 +349,7 @@ void Firefox3Importer::GetSearchEnginesXMLFiles(
const std::wstring kAppPrefix = L"[app]/";
const std::wstring kProfilePrefix = L"[profile]/";
do {
- std::wstring file;
+ FilePath file;
std::wstring engine = UTF8ToWide(s.column_string(0));
// The string contains [app]/<name>.xml or [profile]/<name>.xml where
@@ -354,30 +358,27 @@ void Firefox3Importer::GetSearchEnginesXMLFiles(
size_t index = engine.find(kAppPrefix);
if (index != std::wstring::npos) {
// Remove '[app]/'.
- file = app_path;
- file_util::AppendToPath(&file,
- engine.substr(index + kAppPrefix.length()));
+ file = app_path.Append(FilePath::FromWStringHack(
+ engine.substr(index + kAppPrefix.length())));
} else if ((index = engine.find(kProfilePrefix)) != std::wstring::npos) {
// Remove '[profile]/'.
- file = profile_path;
- file_util::AppendToPath(&file,
- engine.substr(index + kProfilePrefix.length()));
+ file = profile_path.Append(
+ FilePath::FromWStringHack(
+ engine.substr(index + kProfilePrefix.length())));
} else {
// Looks like absolute path to the file.
- file = engine;
+ file = FilePath::FromWStringHack(engine);
}
files->push_back(file);
} while (s.step() == SQLITE_ROW && !cancelled());
}
// Get search engine definition from file system.
- file_util::FileEnumerator engines(FilePath::FromWStringHack(app_path),
- false,
+ file_util::FileEnumerator engines(app_path, false,
file_util::FileEnumerator::FILES);
for (FilePath engine_path = engines.Next(); !engine_path.value().empty();
engine_path = engines.Next()) {
- std::wstring enginew = engine_path.ToWStringHack();
- files->push_back(enginew);
+ files->push_back(engine_path);
}
}
diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h
index 04baf49..fcdb898 100644
--- a/chrome/browser/importer/firefox3_importer.h
+++ b/chrome/browser/importer/firefox3_importer.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "chrome/browser/importer/importer.h"
#include "googleurl/src/gurl.h"
@@ -40,7 +41,7 @@ class Firefox3Importer : public Importer {
// Import the user's home page, unless it is set to default home page as
// defined in browserconfig.properties.
void ImportHomepage();
- void GetSearchEnginesXMLFiles(std::vector<std::wstring>* files);
+ void GetSearchEnginesXMLFiles(std::vector<FilePath>* files);
// The struct stores the information about a bookmark item.
struct BookmarkItem {
@@ -76,8 +77,8 @@ class Firefox3Importer : public Importer {
const FaviconMap& favicon_map,
std::vector<history::ImportedFavIconUsage>* favicons);
- std::wstring source_path_;
- std::wstring app_path_;
+ FilePath source_path_;
+ FilePath app_path_;
DISALLOW_COPY_AND_ASSIGN(Firefox3Importer);
};
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 36a3741..833892f 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -134,7 +134,7 @@ bool CanImportURL(const GURL& url) {
return true;
}
-void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
+void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
std::vector<TemplateURL*>* search_engines) {
DCHECK(search_engines);
@@ -143,7 +143,7 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
// The first XML file represents the default search engine in Firefox 3, so we
// need to keep it on top of the list.
TemplateURL* default_turl = NULL;
- for (std::vector<std::wstring>::const_iterator file_iter = xml_files.begin();
+ for (std::vector<FilePath>::const_iterator file_iter = xml_files.begin();
file_iter != xml_files.end(); ++file_iter) {
file_util::ReadFileToString(*file_iter, &content);
TemplateURL* template_url = new TemplateURL();
@@ -187,30 +187,25 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
}
}
-bool ReadPrefFile(const std::wstring& path_name,
- const std::wstring& file_name,
- std::string* content) {
+bool ReadPrefFile(const FilePath& path, std::string* content) {
if (content == NULL)
return false;
- std::wstring file = path_name;
- file_util::AppendToPath(&file, file_name.c_str());
-
- file_util::ReadFileToString(file, content);
+ file_util::ReadFileToString(path, content);
if (content->empty()) {
- NOTREACHED() << L"Firefox preference file " << file_name.c_str()
- << L" is empty.";
+ NOTREACHED() << "Firefox preference file " << path.value()
+ << " is empty.";
return false;
}
return true;
}
-std::string ReadBrowserConfigProp(const std::wstring& app_path,
+std::string ReadBrowserConfigProp(const FilePath& app_path,
const std::string& pref_key) {
std::string content;
- if (!ReadPrefFile(app_path, L"browserconfig.properties", &content))
+ if (!ReadPrefFile(app_path.AppendASCII("browserconfig.properties"), &content))
return "";
// This file has the syntax: key=value.
@@ -232,10 +227,10 @@ std::string ReadBrowserConfigProp(const std::wstring& app_path,
return content.substr(start + 1, stop - start - 1);
}
-std::string ReadPrefsJsValue(const std::wstring& profile_path,
+std::string ReadPrefsJsValue(const FilePath& profile_path,
const std::string& pref_key) {
std::string content;
- if (!ReadPrefFile(profile_path, L"prefs.js", &content))
+ if (!ReadPrefFile(profile_path.AppendASCII("prefs.js"), &content))
return "";
// This file has the syntax: user_pref("key", value);
@@ -266,7 +261,7 @@ std::string ReadPrefsJsValue(const std::wstring& profile_path,
int GetFirefoxDefaultSearchEngineIndex(
const std::vector<TemplateURL*>& search_engines,
- const std::wstring& profile_path) {
+ const FilePath& profile_path) {
// The default search engine is contained in the file prefs.js found in the
// profile directory.
// It is the "browser.search.selectedEngine" property.
@@ -300,7 +295,7 @@ int GetFirefoxDefaultSearchEngineIndex(
return default_se_index;
}
-GURL GetHomepage(const std::wstring& profile_path) {
+GURL GetHomepage(const FilePath& profile_path) {
std::string home_page_list =
ReadPrefsJsValue(profile_path, "browser.startup.homepage");
@@ -311,8 +306,7 @@ GURL GetHomepage(const std::wstring& profile_path) {
return GURL(home_page_list.substr(0, seperator));
}
-bool IsDefaultHomepage(const GURL& homepage,
- const std::wstring& app_path) {
+bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path) {
if (!homepage.is_valid())
return false;
diff --git a/chrome/browser/importer/firefox_importer_utils.h b/chrome/browser/importer/firefox_importer_utils.h
index 8927af0..4e00b5a 100644
--- a/chrome/browser/importer/firefox_importer_utils.h
+++ b/chrome/browser/importer/firefox_importer_utils.h
@@ -66,22 +66,22 @@ bool CanImportURL(const GURL& url);
// Parses the OpenSearch XML files in |xml_files| and populates |search_engines|
// with the resulting TemplateURLs.
-void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
+void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
std::vector<TemplateURL*>* search_engines);
// Returns the index of the default search engine in the |search_engines| list.
// If none is found, -1 is returned.
int GetFirefoxDefaultSearchEngineIndex(
const std::vector<TemplateURL*>& search_engines,
- const std::wstring& profile_path);
+ const FilePath& profile_path);
// Returns the home page set in Firefox in a particular profile.
-GURL GetHomepage(const std::wstring& profile_path);
+GURL GetHomepage(const FilePath& profile_path);
// Checks to see if this home page is a default home page, as specified by
// the resource file browserconfig.properties in the Firefox application
// directory.
-bool IsDefaultHomepage(const GURL& homepage, const std::wstring& app_path);
+bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path);
#endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_
diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc
index 66ff12b..ee7bbc5 100644
--- a/chrome/browser/importer/mork_reader.cc
+++ b/chrome/browser/importer/mork_reader.cc
@@ -115,8 +115,7 @@ MorkReader::~MorkReader() {
delete i->second;
}
-bool MorkReader::Read(const std::wstring& filename) {
- FilePath path = FilePath::FromWStringHack(filename);
+bool MorkReader::Read(const FilePath& path) {
stream_.open(path.value().c_str());
if (!stream_.is_open())
return false;
@@ -546,8 +545,7 @@ void AddToHistory(MorkReader::ColumnDataList* column_values,
// It sets up the file stream and loops over the lines in the file to
// parse them, then adds the resulting row set to history.
-void ImportHistoryFromFirefox2(const std::wstring& file,
- ImporterBridge* bridge) {
+void ImportHistoryFromFirefox2(const FilePath& file, ImporterBridge* bridge) {
MorkReader reader;
reader.Read(file);
diff --git a/chrome/browser/importer/mork_reader.h b/chrome/browser/importer/mork_reader.h
index 5cd7833..cb61be5 100644
--- a/chrome/browser/importer/mork_reader.h
+++ b/chrome/browser/importer/mork_reader.h
@@ -50,6 +50,7 @@
#include "base/basictypes.h"
+class FilePath;
class ImporterBridge;
class MessageLoop;
class ProfileWriter;
@@ -93,7 +94,7 @@ class MorkReader {
// Read in the given mork file. Returns true on success.
// Note: currently, only single-table mork files are supported
- bool Read(const std::wstring& filename);
+ bool Read(const FilePath& filename);
// Returns the list of columns in the current table.
const MorkColumnList& columns() const { return columns_; }
@@ -161,7 +162,6 @@ class MorkReader {
};
// ImportHistoryFromFirefox2 is the main entry point to the importer.
-void ImportHistoryFromFirefox2(const std::wstring& file,
- ImporterBridge* bridge);
+void ImportHistoryFromFirefox2(const FilePath& file, ImporterBridge* bridge);
#endif // CHROME_BROWSER_IMPORTER_MORK_READER_H__