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

Unified Diff: chrome/installer/util/install_util.cc

Issue 1525042: Additional changes to support Chrome / CF installation wrapped in an MSI:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util.cc
===================================================================
--- chrome/installer/util/install_util.cc (revision 45608)
+++ chrome/installer/util/install_util.cc (working copy)
@@ -136,14 +136,20 @@
DCHECK(command_line)
<< "IsChromeFrameProcess() called before ComamandLine::Init()";
- // Also assume this to be a ChromeFrame process if we are running inside
- // the Chrome Frame DLL.
FilePath module_path;
PathService::Get(base::FILE_MODULE, &module_path);
std::wstring module_name(module_path.BaseName().value());
- return command_line->HasSwitch(installer_util::switches::kChromeFrame) ||
- module_name == installer_util::kChromeFrameDll;
+ scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
+ *command_line));
+ DCHECK(prefs.get());
+ bool is_cf = false;
+ installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kChromeFrame, &is_cf);
+
+ // Also assume this to be a ChromeFrame process if we are running inside
+ // the Chrome Frame DLL.
+ return is_cf || module_name == installer_util::kChromeFrameDll;
}
bool InstallUtil::IsChromeSxSProcess() {
@@ -164,18 +170,72 @@
chrome_sxs_dir);
}
-bool InstallUtil::IsMSIProcess() {
+bool InstallUtil::IsMSIProcess(bool system_level) {
+ // Initialize the static msi flags.
+ static bool is_msi_ = false;
+ static bool msi_checked_ = false;
+
CommandLine* command_line = CommandLine::ForCurrentProcess();
CHECK(command_line);
- scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
- *command_line));
- bool value = false;
- return (installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kMsi, &value) &&
- value);
+ if (!msi_checked_) {
+ msi_checked_ = true;
+
+ scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
+ *command_line));
+ DCHECK(prefs.get());
+ bool is_msi = false;
+ installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kMsi, &is_msi);
+
+ if (!is_msi) {
+ // We didn't find it in the preferences, try looking in the registry.
+ HKEY reg_root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegKey key;
+ DWORD msi_value;
+
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ DCHECK(dist);
+
+ bool success = false;
+ std::wstring reg_key(dist->GetStateKey());
+ if (key.Open(reg_root, reg_key.c_str(), KEY_READ | KEY_WRITE)) {
+ if (key.ReadValueDW(google_update::kRegMSIField, &msi_value)) {
+ is_msi = (msi_value == 1);
+ }
+ }
+ }
+
+ is_msi_ = is_msi;
+ }
+
+ return is_msi_;
}
+bool InstallUtil::SetMSIMarker(bool system_level, bool set) {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ DCHECK(dist);
+ std::wstring client_state_path(dist->GetStateKey());
+
+ bool success = false;
+ HKEY reg_root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegKey client_state_key;
+ if (client_state_key.Open(reg_root, client_state_path.c_str(),
+ KEY_READ | KEY_WRITE)) {
+ DWORD msi_value = set ? 1 : 0;
+ if (client_state_key.WriteValue(google_update::kRegMSIField, msi_value)) {
+ success = true;
+ } else {
+ LOG(ERROR) << "Could not write msi value to client state key.";
+ }
+ } else {
+ LOG(ERROR) << "Could not open client state key!";
+ }
+
+ return success;
+}
+
+
bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path,
const wchar_t** const dll_names,
int dll_names_count,
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698