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

Side by Side Diff: chrome/browser/importer/firefox_importer_utils_win.cc

Issue 3007037: Cleanup our Registry API. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: fix nit Created 10 years, 4 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
« no previous file with comments | « base/registry.cc ('k') | chrome/common/chrome_plugin_lib.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/importer/firefox_importer_utils.h" 5 #include "chrome/browser/importer/firefox_importer_utils.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/registry.h" 10 #include "base/registry.h"
(...skipping 25 matching lines...) Expand all
36 if (!result) 36 if (!result)
37 continue; 37 continue;
38 highest_version = std::max(highest_version, _wtoi(ver_buffer)); 38 highest_version = std::max(highest_version, _wtoi(ver_buffer));
39 } 39 }
40 return highest_version; 40 return highest_version;
41 } 41 }
42 42
43 std::wstring GetFirefoxInstallPathFromRegistry() { 43 std::wstring GetFirefoxInstallPathFromRegistry() {
44 // Detects the path that Firefox is installed in. 44 // Detects the path that Firefox is installed in.
45 std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox"; 45 std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
46 TCHAR buffer[MAX_PATH]; 46 wchar_t buffer[MAX_PATH];
47 DWORD buffer_length = sizeof(buffer); 47 DWORD buffer_length = sizeof(buffer);
48 RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str()); 48 RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str());
49 bool result = reg_key.ReadValue(L"CurrentVersion", buffer, 49 bool result = reg_key.ReadValue(L"CurrentVersion", buffer,
50 &buffer_length, NULL); 50 &buffer_length, NULL);
51 if (!result) 51 if (!result)
52 return std::wstring(); 52 return std::wstring();
53 registry_path += L"\\" + std::wstring(buffer) + L"\\Main"; 53 registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
54 buffer_length = sizeof(buffer); 54 buffer_length = sizeof(buffer);
55 RegKey reg_key_directory = RegKey(HKEY_LOCAL_MACHINE, registry_path.c_str()); 55 RegKey reg_key_directory(HKEY_LOCAL_MACHINE, registry_path.c_str());
56 result = reg_key_directory.ReadValue(L"Install Directory", buffer, 56 result = reg_key_directory.ReadValue(L"Install Directory", buffer,
57 &buffer_length, NULL); 57 &buffer_length, NULL);
58 if (!result) 58 if (!result)
59 return std::wstring(); 59 return std::wstring();
60 return buffer; 60 return buffer;
61 } 61 }
62 62
63 FilePath GetProfilesINI() { 63 FilePath GetProfilesINI() {
64 FilePath ini_file; 64 FilePath ini_file;
65 // The default location of the profile folder containing user data is 65 // The default location of the profile folder containing user data is
66 // under the "Application Data" folder in Windows XP. 66 // under the "Application Data" folder in Windows XP.
67 wchar_t buffer[MAX_PATH] = {0}; 67 wchar_t buffer[MAX_PATH] = {0};
68 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 68 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL,
69 SHGFP_TYPE_CURRENT, buffer))) { 69 SHGFP_TYPE_CURRENT, buffer))) {
70 ini_file = FilePath(buffer).Append(L"Mozilla\\Firefox\\profiles.ini"); 70 ini_file = FilePath(buffer).Append(L"Mozilla\\Firefox\\profiles.ini");
71 } 71 }
72 if (file_util::PathExists(ini_file)) 72 if (file_util::PathExists(ini_file))
73 return ini_file; 73 return ini_file;
74 74
75 return FilePath(); 75 return FilePath();
76 } 76 }
OLDNEW
« no previous file with comments | « base/registry.cc ('k') | chrome/common/chrome_plugin_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698