summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 19:46:34 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 19:46:34 +0000
commitebc34e011dcb9556407b6d724e1336c9852141a7 (patch)
tree26e30fcc9911985b7fa0f50e1b2fed4da87c0269 /chrome/browser
parent145a5389c04af7705e7c9bc973f65ce2c51daa78 (diff)
downloadchromium_src-ebc34e011dcb9556407b6d724e1336c9852141a7.zip
chromium_src-ebc34e011dcb9556407b6d724e1336c9852141a7.tar.gz
chromium_src-ebc34e011dcb9556407b6d724e1336c9852141a7.tar.bz2
importer: Return FilePath in GetFirefoxInstallPathFromRegistry().
This removes one more usage of FromWStringHack call. BUG=24672 TEST=None R=avi@chromium.org Review URL: http://codereview.chromium.org/6821011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/importer/firefox_importer_utils.h37
-rw-r--r--chrome/browser/importer/firefox_importer_utils_win.cc12
-rw-r--r--chrome/browser/importer/importer_list.cc3
3 files changed, 25 insertions, 27 deletions
diff --git a/chrome/browser/importer/firefox_importer_utils.h b/chrome/browser/importer/firefox_importer_utils.h
index b5c4d6d..95391ce 100644
--- a/chrome/browser/importer/firefox_importer_utils.h
+++ b/chrome/browser/importer/firefox_importer_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,18 +19,17 @@ class TemplateURL;
#if defined(OS_WIN)
// Detects which version of Firefox is installed from registry. Returns its
-// major version, and drops the minor version. Returns 0 if
-// failed. If there are indicators of both FF2 and FF3 it is
-// biased to return the biggest version.
+// major version, and drops the minor version. Returns 0 if failed. If there are
+// indicators of both Firefox 2 and Firefox 3 it is biased to return the biggest
+// version.
int GetCurrentFirefoxMajorVersionFromRegistry();
-// Detects where Firefox lives. Returns a empty string if Firefox
-// is not installed.
-std::wstring GetFirefoxInstallPathFromRegistry();
+// Detects where Firefox lives. Returns an empty path if Firefox is not
+// installed.
+FilePath GetFirefoxInstallPathFromRegistry();
#endif // OS_WIN
#if defined(OS_MACOSX)
-
// Get the directory in which the Firefox .dylibs live, we need to load these
// in order to decoded FF profile passwords.
// The Path is usuall FF App Bundle/Contents/Mac OS/
@@ -41,19 +40,19 @@ FilePath GetFirefoxDylibPath();
// Returns the path to the Firefox profile.
FilePath GetFirefoxProfilePath();
-// Detects version of Firefox and installation path from given Firefox profile
+// Detects version of Firefox and installation path for the given Firefox
+// profile.
bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path,
int* version,
FilePath* app_path);
-// Gets the full path of the profiles.ini file. This file records
-// the profiles that can be used by Firefox. Returns an empty
-// string if failed.
+// Gets the full path of the profiles.ini file. This file records the profiles
+// that can be used by Firefox. Returns an empty path if failed.
FilePath GetProfilesINI();
// Parses the profile.ini file, and stores its information in |root|.
-// This file is a plain-text file. Key/value pairs are stored one per
-// line, and they are separeated in different sections. For example:
+// This file is a plain-text file. Key/value pairs are stored one per line, and
+// they are separated in different sections. For example:
// [General]
// StartWithLastProfile=1
//
@@ -65,8 +64,8 @@ FilePath GetProfilesINI();
// "Genenral.StartWithLastProfile" has the value "1".
void ParseProfileINI(const FilePath& file, DictionaryValue* root);
-// Returns true if we want to add the URL to the history. We filter
-// out the URL with a unsupported scheme.
+// Returns true if we want to add the URL to the history. We filter out the URL
+// with a unsupported scheme.
bool CanImportURL(const GURL& url);
// Parses the OpenSearch XML files in |xml_files| and populates |search_engines|
@@ -92,12 +91,12 @@ bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path);
// in |prefs|. Keys are strings, and values can be strings, booleans or
// integers. Returns true if it succeeded, false otherwise (in which case
// |prefs| is not filled).
-// Note: for strings, only valid UTF-8 string values are supported. If a
+// Note: for strings, only valid UTF-8 string values are supported. If a
// key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|.
bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs);
-// Parses the value of a particular firefox preference from a string that is
-// the contents of the prefs file.
+// Parses the value of a particular firefox preference from a string that is the
+// contents of the prefs file.
std::string GetPrefsJsValue(const std::string& prefs,
const std::string& pref_key);
diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc
index 16696b9..e3925ef 100644
--- a/chrome/browser/importer/firefox_importer_utils_win.cc
+++ b/chrome/browser/importer/firefox_importer_utils_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -40,7 +40,7 @@ int GetCurrentFirefoxMajorVersionFromRegistry() {
return highest_version;
}
-std::wstring GetFirefoxInstallPathFromRegistry() {
+FilePath GetFirefoxInstallPathFromRegistry() {
// Detects the path that Firefox is installed in.
std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
wchar_t buffer[MAX_PATH];
@@ -50,16 +50,16 @@ std::wstring GetFirefoxInstallPathFromRegistry() {
LONG result = reg_key.ReadValue(L"CurrentVersion", buffer,
&buffer_length, NULL);
if (result != ERROR_SUCCESS)
- return std::wstring();
+ return FilePath();
+
registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
buffer_length = sizeof(buffer);
base::win::RegKey reg_key_directory(HKEY_LOCAL_MACHINE,
registry_path.c_str(), KEY_READ);
result = reg_key_directory.ReadValue(L"Install Directory", buffer,
&buffer_length, NULL);
- if (result != ERROR_SUCCESS)
- return std::wstring();
- return buffer;
+
+ return (result != ERROR_SUCCESS) ? FilePath() : FilePath(buffer);
}
FilePath GetProfilesINI() {
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index b76b165..97eeeae 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -78,8 +78,7 @@ void DetectFirefoxProfiles(std::vector<importer::SourceProfile*>* profiles) {
firefox->importer_type = firefox_type;
firefox->source_path = profile_path;
#if defined(OS_WIN)
- firefox->app_path = FilePath::FromWStringHack(
- GetFirefoxInstallPathFromRegistry());
+ firefox->app_path = GetFirefoxInstallPathFromRegistry();
#endif
if (firefox->app_path.empty())
firefox->app_path = app_path;