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

Unified Diff: chrome/browser/importer/firefox_importer_utils.cc

Issue 114047: Add import progress indicator dialog. (Closed)
Patch Set: code review fixes Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/importer/firefox_importer_utils.cc
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 66e30b0d0288654e470e06cb1517092a227ec367..afe484e84c0edb9988e5bb9e063406070b0abdb3 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -83,8 +83,8 @@ class SetDllDirectoryCaller {
} // namespace
-int GetCurrentFirefoxMajorVersion() {
#if defined(OS_WIN)
+int GetCurrentFirefoxMajorVersionFromRegistry() {
TCHAR ver_buffer[128];
DWORD ver_buffer_length = sizeof(ver_buffer);
int highest_version = 0;
@@ -100,13 +100,28 @@ int GetCurrentFirefoxMajorVersion() {
highest_version = std::max(highest_version, _wtoi(ver_buffer));
}
return highest_version;
-#else
- // TODO(port): Read in firefox configuration.
- NOTIMPLEMENTED();
- return 0;
-#endif
}
+std::wstring GetFirefoxInstallPathFromRegistry() {
+ // Detects the path that Firefox is installed in.
+ std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
+ TCHAR buffer[MAX_PATH];
+ DWORD buffer_length = sizeof(buffer);
+ bool result;
+ result = ReadFromRegistry(HKEY_LOCAL_MACHINE, registry_path.c_str(),
+ L"CurrentVersion", buffer, &buffer_length);
+ if (!result)
+ return std::wstring();
+ registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
+ buffer_length = sizeof(buffer);
+ result = ReadFromRegistry(HKEY_LOCAL_MACHINE, registry_path.c_str(),
+ L"Install Directory", buffer, &buffer_length);
+ if (!result)
+ return std::wstring();
+ return buffer;
+}
+#endif
+
#if defined(OS_WIN) || defined(OS_LINUX)
bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path,
int* version,
@@ -209,31 +224,6 @@ void ParseProfileINI(std::wstring file, DictionaryValue* root) {
}
#endif
-std::wstring GetFirefoxInstallPath() {
-#if defined(OS_WIN)
- // Detects the path that Firefox is installed in.
- std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
- TCHAR buffer[MAX_PATH];
- DWORD buffer_length = sizeof(buffer);
- bool result;
- result = ReadFromRegistry(HKEY_LOCAL_MACHINE, registry_path.c_str(),
- L"CurrentVersion", buffer, &buffer_length);
- if (!result)
- return std::wstring();
- registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
- buffer_length = sizeof(buffer);
- result = ReadFromRegistry(HKEY_LOCAL_MACHINE, registry_path.c_str(),
- L"Install Directory", buffer, &buffer_length);
- if (!result)
- return std::wstring();
- return buffer;
-#else
- // TODO(port): Load firefox configuration.
- NOTIMPLEMENTED();
- return std::wstring();
-#endif
-}
-
bool CanImportURL(const GURL& url) {
const char* kInvalidSchemes[] = {"wyciwyg", "place", "about", "chrome"};
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.h ('k') | chrome/browser/importer/firefox_profile_lock_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698